On Jan 9, 2014, at 7:09 PM, Allan Odgaard mailinglist@textmate.org wrote:
On 7 Jan 2014, at 8:28, Matt Neuburg wrote:
My bundle command, written in Ruby, looks like this:
s = #... command-line command that produces many lines of output STDOUT.sync = true puts '<pre>' puts `#{s}` puts '</pre>'
It is set to output as HTML. In TextMate 1, the result was correctly formatted: line after line of text, wrapped in <pre> tags, wrapped in HTML. In TextMate 2, the opening and closing <pre> tags both appear before the output from executing s, and thus the output is not correctly formatted.
Clearly something has changed. What's the new correct way of doing this? Thanks - m.
This could happen if your command (āsā) outputs to stderr (instead of stdout).
Great suggestion, thanks! As you advised, I dealt with this by calling popen3 (actually I used popen2e):
puts "<pre>" puts "Converting #{f}..." require 'open3' Open3.popen2e(s) do |i,o,t| puts o.read end puts "</pre>"
Unfortunately all the output appears at once; it would be nice to get each line of output to appear as it arrives. But one can't have everything...
TextMate::Executor.run() is worth knowing about, but I couldn't get it to work in this case, as it seems to expect a Ruby file. Thanks again, this worked great. m.
-- matt neuburg, phd = matt@tidbits.com, http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 7! http://shop.oreilly.com/product/0636920031017.do iOS 7 Fundamentals! http://shop.oreilly.com/product/0636920032465.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com