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
On 9. Mar 2007, at 20:20, Patrick Gundlach wrote:
[...] 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?
I recently wrote a custom version for popen3 to get the pid (so that we could provide the ⌃C-break functionality) -- likely the subclass you refer to (UserScript) needs appropriate updating (I’ll check it out later).
On Mar 9, 2007, at 2:13 PM, Allan Odgaard wrote:
I recently wrote a custom version for popen3 to get the pid (so that we could provide the ⌃C-break functionality)
Just FYI, this has been done before:
http://raa.ruby-lang.org/project/popen4/
James Edward Gray II
Hi Allan, others,
[...] 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?
I recently wrote a custom version for popen3 to get the pid (so that we could provide the ⌃C-break functionality) -- likely the subclass you refer to (UserScript) needs appropriate updating (I’ll check it out later).
I've checked out todays support directory and have a few problems:
---------------- $:.unshift ENV['TM_SUPPORT_PATH'] + "/lib"
require 'scriptmate'
cmd_mate('ls') ----------------
gives me
/Users/pg/Library/Application Support/TextMate/Support/lib/scriptmate.rb:106:in `emit_html': undefined method `fcntl' for [#, #]:Array (NoMethodError) from /Users/pg/Library/Application Support/TextMate/Support/lib/scriptmate.rb:106:in `each' from /Users/pg/Library/Application Support/TextMate/Support/lib/scriptmate.rb:106:in `emit_html' from /Users/pg/Library/Application Support/TextMate/Support/lib/scriptmate.rb:46:in `cmd_mate' from parse_texrun.rb:10
when I change line 56 in scriptmate.rb to
return stdout, stderr, File.open('/dev/null'), pid
(I vaguely remember this being in the old scriptmate.rb), I get an output with a surprising 'nil' at the end:
.... <--- OK .... <--- OK nil <--- unwanted
Thanks so far,
Patrick
Hey Patrick,
Sorry about the delay, but this is fixed in latest svn. I was using IO::open incorrectly, which was causing the bug. The erroneous nil is gone now too.
–Alex
On Mar 14, 2007, at 3:25 AM, Patrick Gundlach wrote:
Hi Allan, others,
[...] 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?
I recently wrote a custom version for popen3 to get the pid (so that we could provide the ⌃C-break functionality) -- likely the subclass you refer to (UserScript) needs appropriate updating (I’ll check it out later).
I've checked out todays support directory and have a few problems:
$:.unshift ENV['TM_SUPPORT_PATH'] + "/lib"
require 'scriptmate'
cmd_mate('ls')
gives me
/Users/pg/Library/Application Support/TextMate/Support/lib/ scriptmate.rb:106:in `emit_html': undefined method `fcntl' for [#, #]:Array (NoMethodError) from /Users/pg/Library/Application Support/TextMate/Support/lib/ scriptmate.rb:106:in `each' from /Users/pg/Library/Application Support/TextMate/Support/lib/ scriptmate.rb:106:in `emit_html' from /Users/pg/Library/Application Support/TextMate/Support/lib/ scriptmate.rb:46:in `cmd_mate' from parse_texrun.rb:10
when I change line 56 in scriptmate.rb to
return stdout, stderr, File.open('/dev/null'), pid
(I vaguely remember this being in the old scriptmate.rb), I get an output with a surprising 'nil' at the end:
.... <--- OK .... <--- OK nil <--- unwanted
Thanks so far,
Patrick
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate