Subject: [sup-talk] patch: execute shell command

From: [email-masked] (Eyal Oren)
Date: Thu, 08 Nov 2007 16:47:30 +0100

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

---

From: [email-masked] (William Morgan)
Date: Sun, 11 Nov 2007 20:13:40 -0800

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>

---

From: [email-masked] (Eyal Oren)
Date: Mon, 12 Nov 2007 14:05:31 +0900

> here. Is there a reason to use it instead of just something like
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 ``?

> scroll-mode.rb, since, unless I'm mistaken, it's not specific to
Agree. Wasn't sure where to put it, actually.

-- 
 -eyal

---

From: [email-masked] (Marcus Williams)
Date: Mon, 12 Nov 2007 15:35:34 +0000

> 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

---

From: [email-masked] (William Morgan)
Date: Mon, 12 Nov 2007 08:59:35 -0800

> 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.