Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Get exit code of a command run via coproc {cmd}?
- X-seq: zsh-workers 51734
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: Get exit code of a command run via coproc {cmd}?
- Date: Tue, 9 May 2023 10:08:33 -0700
- Archived-at: <https://zsh.org/workers/51734>
- In-reply-to: <CAKc7PVD4Odj_gVDV4QJJw+cgYeod_0=BEwaF0xgNQAJ6g=fDbg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAKc7PVD4Odj_gVDV4QJJw+cgYeod_0=BEwaF0xgNQAJ6g=fDbg@mail.gmail.com>
On Tue, May 9, 2023 at 2:46 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> I'm running a command in coproc:
> I would like to know if the [coproc] succeeded
The value of $! immediately after starting the coproc is its process
ID, just like any other background job.
coproc ...
coproc_pid=$!
...
wait $coproc_pid
will give you the exit status, modulo the caveats explained under the
"wait" description.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author