[TxMt] scriptmate.rb question

Patrick Gundlach textmate at contextgarden.net
Fri Mar 9 19:20:33 UTC 2007


Hi,

I'd link to run a shell command in a bundle and capture the output in
the html window. So I thought scriptmate.rb seems to be a good way to
go, but I am a bit clueless. Running this from the command line gives
me an error.

--------------------------------------------------
#!/usr/bin/env ruby

ENV['TM_SUPPORT_PATH']="/Applications/TextMate.app/Contents/SharedSupport/Support"

$:.unshift ENV['TM_SUPPORT_PATH'] + "/lib"

require 'scriptmate'

cmd_mate("ls")
--------------------------------------------------
nil
/Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:92:in `waitpid': no implicit conversion from nil to integer (TypeError)
        from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:92:in `emit_html'
        from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/scriptmate.rb:16:in `cmd_mate'
        from ./parse_texrun.rb:42



And scriptmate.rb looks a bit strange to me:

....
def emit_html
    emit_header()
    stdout, stderr, stack_dump, pid = @command.run
....

is trying to get 4 parameters from @command.run, but UserCommand#run
only returns 3. A related question: is it possible to get a pid from
popen3?

Patrick



More information about the textmate mailing list