top | item 46234744

(no title)

not_your_vase | 2 months ago

Hack:

    long-running-command &
    pid_of_long_running_cmd=$(pidof long-running-command)
    tail --pid=$pid_pf_long_running_cmd -f /dev/null && forgotten-command
Tail quits when $pid_pf_long_running_cmd disappears, and kicks off the forgotten-command. (It won't know however the exit code of the original cmd, so that's a drawback)

discuss

order

baobun|2 months ago

Yeah, the problem here is it requires preparation and preemptively adding that '&' to the first command. It doesn't work for the "oh, right" situations. Running all commands this way by default wouldn't make life easier.

But along those lines yeah, it's basically the same as the "wait for it in another terminal" approach and I guess a solution would contain something similar.