Dear Hans,
Now it happened to me, that a script was actually finished, but the loading-circle of the textmate-window still indicated, that the script is running. (I saw that it actually was finished by the files it generates).
I also didn't get any print-messages that were in the code.
best, martin
On 04.02.2012, at 18:16, Hans-Jörg Bibiko wrote:
Hi,
maybe I found a fix for that issue (at least my test script now runs :) ):
The new R.tmbundle stuff I host at https://github.com/avian/r.tmbundle/ thus here the code which should be tested.
Please replace everything in between
STDOUT.sync = true {... and ...} STDOUT.flush
in file tmR.rb by:
STDOUT.sync = false STDERR.sync = false
descriptors = [stdout, stderr] descriptors.each { |fd| fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) } until descriptors.empty? select(descriptors).shift.each do |io| begin str = io.readline rescue descriptors.delete io io.close break end if str.nil? or str.empty? descriptors.delete io io.close elsif io == stderr # just in case print hideStartMessageJS print %{<span style="color: red">#{esc str}</span>} elsif io == stdout print hideStartMessageJS str.each_line do |line| # line counter for top level source if line.include?("#{linecountermarker}") linecounter += 1 line.sub!("#{linecountermarker}", '') end # check for a comment sign at the beginning of a line if line.match(/>\s*#/) print "<i><font color=blue>#{esc line.chomp}</font></i>\n" # check for a comment within a line - regexp should be improved yet! elsif m=line.match(/(.*?)(#[^"']*)$/) print esc(m[1]).gsub(/^(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') print "<i><font color=blue>#{esc(m[2]).chomp}</font></i>\n" # check for error messages elsif m=line.match(/(?i)^\s*(error|erreur|fehler|errore|erro)( |:)/) where = (isSelection) ? " of selection" : "" print "<span style='color: red'>#{esc str.gsub(%r{(?m).*?#{m[1]}},m[1]).chomp}<br /><i>RMate</i> stopped at <a href='txmt://open?line=#{linecounter}'>line #{linecounter-selectionlinestart}#{where}</a></span><br />".gsub(%r{source("(.*?)")},'source("<a href="txmt://open?url=file://\1">\1</a>")') print "<hr noshade width='300' size='2' align='left' color=lightgrey>" break # check for warnings elsif line.match(/^\s*(Warning|Warning messages?|Message d.avis|Warnmeldung|Messaggio di avvertimento|Mensagem de aviso):/) print "<span style='color: gray'>#{esc line}</span>" # print line simply with hyperlinked prompt if given elsif line.match(/_\x8./) print "#{line.gsub(/_\x8(.)/,'<b>\1</b>')}" else print esc(line).gsub(/^[\x0-\x9]?(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') end end end end end
STDOUT.flush
Feedback is welcome :)
Cheers, --Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate