[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: obtaining process exit code from popen()
- From: steve donovan <steve.j.donovan@...>
- Date: Sat, 6 Jun 2009 11:54:09 +0200
On Sat, Jun 6, 2009 at 10:07 AM, Patrick Donnelly<email@example.com> wrote:
> I believe you meant: "|| echo $?"
This is a fuller elaboration of the hack; you get the status code any
way (because you will need to strip it out with some pattern)
I checked out luaex, but ex.popen gives you a process-object and a
file handle. No way to tell from that, it appears.
local f = io.popen(cmd..'; echo "-retcode:$?"' ,'r')
local l = f:read '*a'
local i1,i2,ret = l:find('%-retcode:(%d+)\n$')
l = l:sub(1,i1-1)
print(command 'which lua')