bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Several issues with coprocesses regarding exit status


From: Greg Wooledge
Subject: Re: Several issues with coprocesses regarding exit status
Date: Tue, 11 Dec 2012 14:49:24 -0500
User-agent: Mutt/1.4.2.3i

On Tue, Dec 11, 2012 at 02:31:28PM -0500, DJ Mills wrote:
>   First of all, the man page and help output state:
>     `The return status of a coprocess is the exit status of command.'
>   No matter what, coproc seems to always return true.
> 
>   To reproduce:
>     coproc false || echo error1 >&2; wait "$COPROC_PID" || echo error2 >&2

Since coproc creates a background job, it doesn't really makes sense that
the "coproc" command itself would know the exit status of the background
job.  It would have to wait for the background job to terminate first,
which would defeat the whole purpose.

So, I'd just call it a documentation flaw.  Most likely "coproc" is
indicating whether it successfully created the coprocess (bg job), and
you'll have to use "wait" to fetch its exit status once it becomes
available.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]