From c61a23e4d65ecb86c579c2f99f16e84200626e20 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 12 Dec 2012 23:16:09 -0500 Subject: [PATCH] fix and document the exit status --- README.rst | 4 ++++ termite.cc | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index d7c29f3..9880e3a 100644 --- a/README.rst +++ b/README.rst @@ -3,6 +3,10 @@ A simple VTE-based terminal. Termite looks for ``termite.cfg`` in ``$XDG_CONFIG_HOME`` (or ``~/.config`` if unset) and then falls back to ``$XDG_CONFIG_DIRS``. +Termite's exit status is 1 on a failure, including a termination of the child +process from an uncaught signal. Otherwise the exit status is that of the child +process. + DEPENDENCIES ============ diff --git a/termite.cc b/termite.cc index e2981c3..9e2c66d 100644 --- a/termite.cc +++ b/termite.cc @@ -1147,8 +1147,13 @@ static void load_config(GtkWindow *window, VteTerminal *vte, config_info *info, }/*}}}*/ static void exit_with_status(VteTerminal *vte) { + int status = vte_terminal_get_child_exit_status(vte); gtk_main_quit(); - exit(vte_terminal_get_child_exit_status(vte)); + if (WIFEXITED(status)) { + exit(WEXITSTATUS(status)); + } else { + exit(EXIT_FAILURE); // child did not exit normally + } } int main(int argc, char **argv) {