Getstatusoutput

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs