[file-roller] when canceling an operation kill all the sub-processes as well



commit baff9720f59d85d5118ca0220b7c680dc6964d30
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jun 17 12:22:18 2012 +0200

    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.

 src/fr-process.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/fr-process.c b/src/fr-process.c
index 1d732af..20671e7 100644
--- a/src/fr-process.c
+++ b/src/fr-process.c
@@ -642,6 +642,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);
 }
 
 
@@ -998,7 +1003,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) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]