From: Jan Koprowski Date: 2007-12-06T17:21:16+09:00 Subject: Re: Using popen with 0,1,2,3,4 streams On 4 Gru, 17:58, Tim Pease wrote: > On Dec 3, 2007 5:32 PM, Judson Lester wrote: > > > > > Jan, > > > You might look at popen3 in the standard library. I don't think it quite > > does what you need (since it returns an array if three pipes: stdin, stdout > > and stderr for the subprocess) but the code is short if a little arcane, and > > might point you in the right direction to figure this out. > > > Judson > > > On Dec 2, 2007 3:10 AM, Jan Koprowski wrote: > > > > Hi ! > > > > I try to run command system and get streams handlers to 0 (stdin), > > > 1(stdout), 2(stderr), 3(myOwnStdIn1), 4(myOwnStdIn2). I do something > > > like that in PHP by proc_open and table of pipes, but here I don't > > > know how I can get handlers to process streams. I know that this code > > > is bad but I think something like this: > > > > process =popen('command', 'w+'); > > > stdin = process.new(0, "w"); > > > stdout = process.new(1, "r"); > > > > etc... > > > > But new is a static method. What i should to do ? > > Also take a look at open4 and systemu. You can find both at the > codeforpeople project on RubyForge. They, too, will offer some good > insight on what you want to do, though neither does precisely what you > need. > > > > Blessings, > TwP Thank You for respond. I know that I can use only 3 pipes. But I think I can look for open4 and try to write something similar. Thanks !