[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

getstatusoutput

OliverMarchand

10/6/2006 1:02:00 PM

Dear Ruby fellows,

I am desperately trying to write a quite simple function (something
similar to what I was acumstomed to with Python)

status, stdout, stderr = getstatusoutput(somecmdstring)

status is an integer, stdout and stderr are strings

Now in principle I know how to write such a function, but I don't know
what the best interface to spawn the process given in somecmdstring is.
Here is my analysis of the situation:

IO::popen --- mixes stdout and stderr
Open3.popen3 --- no possibility to wait for the process to finish
exec --- I would have to write "everything" by myself, double fork,
etc.
....popen4 --- not a standard function

Is my analysis right, or is there something I am not understanding
about open3?

thanks for any help,
Oliver