Hello,

On 05/04/2016 10:48 AM, Larry Wilson wrote:
How can I get the exit status of the command I am running?

I'm not able to reproduce this error.
Notice the following:

  $ stdbuf -oL false && echo ok || echo fail
  fail

  $ stdbuf -oL true && echo ok || echo fail
  ok

  $ stdbuf -oL sh -c "exit 42" ; echo $?
  42

  $ stdbuf --version | head -n1
  stdbuf (GNU coreutils) 8.21


Can you provide more details about your error, and how to reproduce it?
(please include '--version' of your stdbuf).

Technically,
stdbuf.c calls 'execvp' ( http://lingrok.org/xref/coreutils/src/stdbuf.c#388 ),
which replaces the current process (stdbuf) with the child's program.
Unless there's an error executing the child program, the returned exit code 
does not come from stdbuf at all.


regards,
 - assaf




Reply via email to