From: "ara.t.howard" Date: 2008-08-02T04:59:58+09:00 Subject: Re: Capturing shell command output and success? On Aug 1, 2008, at 1:32 PM, Kyle Schmitt wrote: > I know shell commands have beaten to death on this list, but searching > the archives I couldn't quite find what I was looking for. > > I want a way to capture the output of the shell command, and the > success or failure of it. > > Of course I've used system("") and %x, and I have been successful in > getting the return code using @?, although something about it rubs me > the wrong way. Not the least of which is that standard error isn't > captured by anything. > > In the case of what I'm doing now, I'd like to shell out to tar, have > an error returned to me if tar doesn't complete successfully, AND have > the output of tar for parsing. > > Is there a clean mechanism to do this? > > Thanks > --Kyle simplest and most portable: gem install systemu status, stdout, stderr = systemu command a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama