GNU bug report logs - #23448
stdbuf exit code does not reflect child status

Previous Next

Package: coreutils;

Reported by: "Larry Wilson" <lwilson <at> jlg-tech.com>

Date: Wed, 4 May 2016 15:35:02 UTC

Severity: normal

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Larry Wilson <lwilson <at> jlg-tech.com>, 23448 <at> debbugs.gnu.org
Subject: bug#23448: stdbuf exit code does not reflect child status
Date: Wed, 4 May 2016 11:48:18 -0400
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





This bug report was last modified 9 years and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.