Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] patch: execute shell command
@ 2007-11-08 15:47 Eyal Oren
  2007-11-12  4:13 ` William Morgan
  0 siblings, 1 reply; 5+ messages in thread
From: Eyal Oren @ 2007-11-08 15:47 UTC (permalink / raw)


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 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [sup-talk] patch: execute shell command
  2007-11-08 15:47 [sup-talk] patch: execute shell command Eyal Oren
@ 2007-11-12  4:13 ` William Morgan
  2007-11-12  5:05   ` Eyal Oren
  0 siblings, 1 reply; 5+ messages in thread
From: William Morgan @ 2007-11-12  4:13 UTC (permalink / raw)


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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [sup-talk] patch: execute shell command
  2007-11-12  4:13 ` William Morgan
@ 2007-11-12  5:05   ` Eyal Oren
  2007-11-12 15:35     ` Marcus Williams
  0 siblings, 1 reply; 5+ messages in thread
From: Eyal Oren @ 2007-11-12  5:05 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [sup-talk] patch: execute shell command
  2007-11-12  5:05   ` Eyal Oren
@ 2007-11-12 15:35     ` Marcus Williams
  2007-11-12 16:59       ` William Morgan
  0 siblings, 1 reply; 5+ messages in thread
From: Marcus Williams @ 2007-11-12 15:35 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [sup-talk] patch: execute shell command
  2007-11-12 15:35     ` Marcus Williams
@ 2007-11-12 16:59       ` William Morgan
  0 siblings, 0 replies; 5+ messages in thread
From: William Morgan @ 2007-11-12 16:59 UTC (permalink / raw)


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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-12 16:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08 15:47 [sup-talk] patch: execute shell command Eyal Oren
2007-11-12  4:13 ` William Morgan
2007-11-12  5:05   ` Eyal Oren
2007-11-12 15:35     ` Marcus Williams
2007-11-12 16:59       ` William Morgan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox