GNOME Bugzilla – Bug 509204
child-exited signal does not provide exit code
Last modified: 2014-04-06 17:43:30 UTC
void (*child_exited)(VteTerminal* terminal); It would be nice if we could get the exit status of the subprocess.
Created attachment 104454 [details] [review] add new signal which includes pid and exit status
Created attachment 111755 [details] [review] [PATCH] Add vte_terminal_get_child_exit_status() so we can get the child's exit status from withint the child-exited signal handlers. Bug #509204. src/vte-private.h | 1 + src/vte.c | 19 +++++++++++++++++++ src/vte.h | 2 ++ 3 files changed, 22 insertions(+), 0 deletions(-)
This patch isn't ABI compatible... I have also a patch for this, which simply adds an accessor function to get the child exit status, since we cannot compatibly change the signal signature either. Also in my testing, the child's exist status as seen by the reaper is the real exist status * 256... any ideas why that would be ?
Well that is weird. I git-send-bugzilla'd AFTER adding my comment, but bz inversed them... so the ABI remark in comment 3 paragraph 1 applies to the patch in comment 1, not my patch in comment 2.
Hm, why wouldn't my patch be ABI compatible? It adds a new signal and leaves the existing one in place as is. It doesn't matter to me though whether there is a new signal or a new special function to call inside the old signal.
Because it changes the VteTerminalClass size and layout. You could get around that with just moving the definitions in place of the reserved slot, of course.
Ah, right; thanks for noticing that. Ok, if the VTE maintainer thinks the additional signal approach is preferable to a function, I'll provide a new patch.
BTW in response to Comment #3 about the exit status being 256; on Unix exit codes are encoded with why the process exited; see section "25.6.2 Exit Status" of the glibc manual.
Behdad, Chris: which patch of the two above do you prefer, a new signal or a function to get the exit status in the handler to the existing signal?
I committed the patch that adds the vte_terminal_get_child_exit_status() function, since it doesn't require using one of the reserved slots in the class struct for the new signal. However I think the other patch that fixes the signal is better, so I'll leave this open so we change this next time we break API/ABI.