in reply to Re^2: How to know the status of a command invoked by open function?
in thread How to know the status of a command invoked by open function?
[ Please don't use <pre>...</pre>. Use <p> at the start of paragraphs and use <c>...</c> around computer text (code, data, output, etc). ]
why the following two opens have different result?
is equivalent toopen(PS,"ls . 2>/dev/null |")
butopen(PS, '-|', /bin/sh', '-c', 'ls . 2>/dev/null ')
get optimised toopen(PS,"ls . |")
open(PS, '-|', 'ls', '.')
Also see the update to my original reply.
But how can i get the exit status for the command in this case?
You already know how. It's in $? after a successful close. In this case, it's 141. The shell returns 141 (128|SIGPIPE) when its child dies from SIGPIPE.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: How to know the status of a command invoked by open function?
by zhujian0805 (Sexton) on Aug 16, 2011 at 01:21 UTC | |
by ikegami (Patriarch) on Aug 16, 2011 at 01:42 UTC | |
by zhujian0805 (Sexton) on Aug 16, 2011 at 01:56 UTC | |
by ikegami (Patriarch) on Aug 16, 2011 at 02:39 UTC |