summaryrefslogtreecommitdiff
path: root/src/plugins/exec
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-04-03 12:24:20 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-04-03 12:24:20 +0200
commita470a1a8901b25a226b49bebe63560a4220b886c (patch)
tree7215afcd5dcea1998c2e733aca6805118ecc9c9e /src/plugins/exec
parentd055d4a2bdfc79f4339cba934d662bc46825f141 (diff)
downloadweechat-a470a1a8901b25a226b49bebe63560a4220b886c.zip
exec: kill all processes using an exec buffer that is being closed
Diffstat (limited to 'src/plugins/exec')
-rw-r--r--src/plugins/exec/exec-buffer.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/plugins/exec/exec-buffer.c b/src/plugins/exec/exec-buffer.c
index 0ddbc8dbe..52c541ea5 100644
--- a/src/plugins/exec/exec-buffer.c
+++ b/src/plugins/exec/exec-buffer.c
@@ -72,9 +72,24 @@ exec_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
int
exec_buffer_close_cb (void *data, struct t_gui_buffer *buffer)
{
+ const char *full_name;
+ struct t_exec_cmd *ptr_exec_cmd;
+
/* make C compiler happy */
(void) data;
- (void) buffer;
+
+ /* kill any command whose output is on this buffer */
+ full_name = weechat_buffer_get_string (buffer, "full_name");
+ for (ptr_exec_cmd = exec_cmds; ptr_exec_cmd;
+ ptr_exec_cmd = ptr_exec_cmd->next_cmd)
+ {
+ if (ptr_exec_cmd->hook
+ && ptr_exec_cmd->buffer_full_name
+ && (strcmp (ptr_exec_cmd->buffer_full_name, full_name) == 0))
+ {
+ weechat_hook_set (ptr_exec_cmd->hook, "signal", "kill");
+ }
+ }
return WEECHAT_RC_OK;
}