|
|||||
|
|
#1 |
|
|
At Mon, 21 Jun 2004 06:06:02 +0900, evanm@frap.net wrote in [ruby-talk:104194]: > > I think IO#popen could stand to be changed, and I wanted to run my ideas by > this list. Currently the problems with popen are: > > * can't byp*** the shell In 1.9, it can as well as Kernel#system. > While looking around for ways to improve on it I came across the Open3 > module in the stdlib, which has a much more "ruby" interface. Based mostly on > that, I redid some methods that could replace IO.popen (and put popen3 in IO > at the same time, which is where it probably belongs) I don't feel that Open3 is more ruby-like, but it's rather perlish. -- Nobu Nakada |
|
|
#2 |
|
|
On Mon, Jun 21, 2004 at 11:34:53AM +0900, nobu.nokada@softhome.net wrote: > Hi, > > At Mon, 21 Jun 2004 06:06:02 +0900, > evanm@frap.net wrote in [ruby-talk:104194]: > > > > I think IO#popen could stand to be changed, and I wanted to run my ideas by > > this list. Currently the problems with popen are: > > > > * can't byp*** the shell > > In 1.9, it can as well as Kernel#system. Really? I went and grabbed ruby-1.9-rodc-20040114.tgz to check it out, and the docs say it's the same. Is there a better place to find this information? Is the mode argument gone? Is the magic "-" value gone? > > > While looking around for ways to improve on it I came across the Open3 > > module in the stdlib, which has a much more "ruby" interface. Based mostly on > > that, I redid some methods that could replace IO.popen (and put popen3 in IO > > at the same time, which is where it probably belongs) > > I don't feel that Open3 is more ruby-like, but it's rather > perlish. To me, magic values in a string are hackish. popen('-') logically is and should be an entirely separate function. I can't really comment on the new version of popen that you're referencing as I can't find any information on it. How does it work? What is its args? Does it drop the '-' and mode arguments? |
|
|
#3 |
|
|
At Mon, 21 Jun 2004 22:02:32 +0900, evanm@frap.net wrote in [ruby-talk:104243]: > > > * can't byp*** the shell > > > > In 1.9, it can as well as Kernel#system. > > Really? I went and grabbed ruby-1.9-rodc-20040114.tgz to check it out, and > the docs say it's the same. Is there a better place to find this information? Sorry, I've forgotten to update the do***ent. > Is the mode argument gone? Is the magic "-" value gone? Both are still there. You can give arguments as an Array. e.g.: IO.popen(%w[echo |arguments| contain shell's <meta> "chars"], "r") > > > While looking around for ways to improve on it I came across the Open3 > > > module in the stdlib, which has a much more "ruby" interface. Based mostly on > > > that, I redid some methods that could replace IO.popen (and put popen3 in IO > > > at the same time, which is where it probably belongs) > > > > I don't feel that Open3 is more ruby-like, but it's rather > > perlish. > > To me, magic values in a string are hackish. popen('-') logically is and should > be an entirely separate function. I can't really comment on the new version of > popen that you're referencing as I can't find any information on it. How does > it work? What is its args? Does it drop the '-' and mode arguments? I'm not sure they are really evil. At Mon, 21 Jun 2004 06:06:02 +0900, evanm@frap.net wrote in [ruby-talk:104194]: > * takes a "mode string" arg for what really should be a separate function > * takes a "-" as a magic value for what really should be a separate function Do you suggest to provide all possible combinations? -- Nobu Nakada |