summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.asciidoc1
-rw-r--r--src/core/wee-hook.c14
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc
index a5469b81a..8819c5b9a 100644
--- a/ChangeLog.asciidoc
+++ b/ChangeLog.asciidoc
@@ -15,6 +15,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
== Version 0.4.4 (under dev)
+* core: fix detection of terminated process in hook_process
* core: set option weechat.look.buffer_search_where to prefix_message by default
* core: fix "/window scroll -N" on a buffer with free content
* core: add option weechat.look.hotlist_add_conditions, remove option
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index 04c2affef..bbc6b055b 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -1720,15 +1720,23 @@ hook_process_timer_cb (void *arg_hook_process, int remaining_calls)
}
else
{
- if (!HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDOUT])
- && !HOOK_PROCESS(hook_process, hook_fd[HOOK_PROCESS_STDERR]))
+ if (waitpid (HOOK_PROCESS(hook_process, child_pid),
+ &status, WNOHANG) > 0)
{
- if (waitpid (HOOK_PROCESS(hook_process, child_pid), &status, WNOHANG) > 0)
+ if (WIFEXITED(status))
{
+ /* child terminated normally */
rc = WEXITSTATUS(status);
hook_process_send_buffers (hook_process, rc);
unhook (hook_process);
}
+ else if (WIFSIGNALED(status))
+ {
+ /* child terminated by a signal */
+ hook_process_send_buffers (hook_process,
+ WEECHAT_HOOK_PROCESS_ERROR);
+ unhook (hook_process);
+ }
}
}