Hacker News new | ask | show | jobs
by 0x45696e6172 905 days ago
I use it to launch GUI apps from the terminal, e.g.

    coproc 'nemo .'
1 comments

Is that better than using ordinary job control (nemo . &) ?
Possibly. There are race conditions with `wait` for `$somepid` because shells kinda have to reap processes as soon as possible, but that means that your `$somepid` can be stale and even refer to some other process. If you have a pipe from the process' stdout and/or stderr then when you can try to read from that pipe to know if the process exited -- you might still lose the exit status, unless you run the program like `(the_program ...; stat=$?; printf '%s\n' $stat 1>&2; exit $stat) &` and then read the exit status from the stderr pipe.
Most GUI apps are noisy as hell in their output.

Though I guess there's always nemo . >/dev/null 2>&1 &