[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: obtaining process exit code from popen()
- From: Asko Kauppi <askok@...>
- Date: Sat, 6 Jun 2009 10:50:31 +0300
I remember having done this years back, by appending "&& echo
<returncode>" to the command itself (and being able to read the output).
<returncode> is whatever $ magic bash uses for showing the return code.
Had similar stuff also for Windows, I can dig up the archives if no-
one else gives a better solution.
It is a hack.
John D. Blair kirjoitti 6.6.2009 kello 3:20:
Has anybody worked out how to obtain the exit code from a sub-process
invoked using popen()?
It looks to me that the exit code is currently discarded b/c the
standard __close meta-method only returns a boolean.
Would it be possible to define an alternate close method (i.e.,
pclose()) which one could use to close a stream opened using popen()
obtain the exit code from the sub-process? Has this already been