Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Get exit code of a command run via coproc {cmd}?



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