summaryrefslogtreecommitdiff
path: root/src/fr-process.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-20 17:11:50 +0100
committerinfirit <[email protected]>2014-11-20 19:40:55 +0100
commit745da983ede2fd45c95f3fb48984083c0ae6b9d1 (patch)
treebc6804efb751521fa2c2692477e1e5742a785ccd /src/fr-process.c
parent5bbef29864117a6ca1caf4e64e18e909bb655256 (diff)
downloadengrampa-745da983ede2fd45c95f3fb48984083c0ae6b9d1.tar.bz2
engrampa-745da983ede2fd45c95f3fb48984083c0ae6b9d1.tar.xz
When canceling an operation kill all the sub-processes as well
create a new process group and kill the process group to stop the operation. Based on FR commit: baff9720f59d85d5118ca0220b7c680dc6964d30 From: Paolo Bacchilega <[email protected]>
Diffstat (limited to 'src/fr-process.c')
-rw-r--r--src/fr-process.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fr-process.c b/src/fr-process.c
index 8855157..61ed636 100644
--- a/src/fr-process.c
+++ b/src/fr-process.c
@@ -643,6 +643,11 @@ child_setup (gpointer user_data)
/* detach from the tty */
setsid ();
+
+ /* create a process group to kill all the child processes when
+ * canceling the operation. */
+
+ setpgid (0, 0);
}
@@ -999,7 +1004,7 @@ fr_process_stop_priv (FrProcess *process,
allow_sticky_processes_only (process, emit_signal);
else if (process->term_on_stop && (process->priv->command_pid > 0))
- kill (process->priv->command_pid, SIGTERM);
+ killpg (process->priv->command_pid, SIGTERM);
else {
if (process->priv->check_timeout != 0) {