Find attached a simple patch (against svn head) to execute a shell command using ''!'' (as in vi or mutt). It requires the ''session'' gem: if you want to get rid of that dependency you can just capture the output using >& etc. It works for me. If I did something wrong, let me know. -- -eyal -------------- next part -------------- A non-text attachment was scrubbed... Name: shell.patch Type: application/octet-stream Size: 1154 bytes Desc: not available Url : http://rubyforge.org/pipermail/sup-talk/attachments/20071108/1f8becde/attachment.obj
Hi Eyal, Excerpts from Eyal Oren''s message of Thu Nov 08 07:47:30 -0800 2007:> Find attached a simple patch (against svn head) to execute a shell > command using ''!'' (as in vi or mutt). It requires the ''session'' gem: > if you want to get rid of that dependency you can just capture the > output using >& etc.I like this functionality but the session gem seems like it''s overkill here. Is there a reason to use it instead of just something like output = `#{cmd}` ? I''m not that familiar with the gem, so maybe there is. Also I think the code for this should be in bin/sup rather than in scroll-mode.rb, since, unless I''m mistaken, it''s not specific to scroll-mode at all. -- William <wmorgan-sup at masanjin.net>
Excerpts from William Morgan''s message of Mon Nov 12 13:13:40 +0900 2007:> I like this functionality but the session gem seems like it''s overkill > here. Is there a reason to use it instead of just something like > output = `#{cmd}`I also wanted to catch error output, to find out if an unexisting command was invoked, and I didn''t know how to do that with ``?> Also I think the code for this should be in bin/sup rather than in > scroll-mode.rb, since, unless I''m mistaken, it''s not specific to > scroll-mode at all.Agree. Wasn''t sure where to put it, actually. -- -eyal
On 12.11.2007, Eyal Oren wrote:> > I like this functionality but the session gem seems like it''s overkill > > here. Is there a reason to use it instead of just something like > > output = `#{cmd}` > I also wanted to catch error output, to find out if an unexisting command was > invoked, and I didn''t know how to do that with ``?Shouldnt this be possible with open3? The only problem is that open3 is unix only (in std ruby). I think there is a win32 open3 gem though. Marcus
Excerpts from Marcus Williams''s message of Mon Nov 12 07:35:34 -0800 2007:> Shouldnt this be possible with open3? The only problem is that open3 > is unix only (in std ruby). I think there is a win32 open3 gem though.It looks like Session doesn''t work on windows, anyways: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/173910 So how''s this for a plan: 1. First version just uses open3. 2. When windows people complain, add code to detect the platform and load in win32-open3 accordingly. -- William <wmorgan-sup at masanjin.net>