[gitg] Correctly reap child process and kill it when cancelling the runner



commit 0ac787cc825a823e370b929bf325d85bce6ff8db
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat Jul 4 19:24:01 2009 +0200

    Correctly reap child process and kill it when cancelling the runner

 gitg/gitg-runner.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gitg/gitg-runner.c b/gitg/gitg-runner.c
index 71fd5db..541b9fc 100644
--- a/gitg/gitg-runner.c
+++ b/gitg/gitg-runner.c
@@ -571,6 +571,8 @@ gitg_runner_run_with_arguments(GitgRunner *runner, gchar const **argv, gchar con
 		return FALSE;
 	}
 	
+	g_child_watch_add (runner->priv->pid, (GChildWatchFunc)runner_io_exit, runner);
+	
 	GInputStream *input_stream = NULL;
 	GOutputStream *output_stream = NULL;
 
@@ -625,6 +627,9 @@ gitg_runner_cancel(GitgRunner *runner)
 		g_object_unref(runner->priv->cancellable);
 		
 		runner->priv->cancellable = g_cancellable_new();
+
+		kill(runner->priv->pid, SIGTERM);
+		
 		runner_io_exit(runner->priv->pid, 1, runner);
 		close_streams(runner);
 



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