channels: refactor jobwait

This commit is contained in:
Björn Linse
2017-07-25 11:59:08 +02:00
parent 5517d2323b
commit f629f8312d
5 changed files with 43 additions and 51 deletions

View File

@@ -639,12 +639,12 @@ static void channel_process_exit_cb(Process *proc, int status, void *data)
terminal_close(chan->term, msg);
}
if (chan->status_ptr) {
*chan->status_ptr = status;
// if status is -1 the process did not really exit,
// we just closed the handle onto a detached process
if (status >= 0) {
process_channel_event(chan, &chan->on_exit, "exit", NULL, 0, status);
}
process_channel_event(chan, &chan->on_exit, "exit", NULL, 0, status);
channel_decref(chan);
}