[gparted/psusi/refactor] fixup! Add proper cancel support (#601239)



commit 7d6c5f4c9835760f7e3272f5d2b90ffacf4407b4
Author: Phillip Susi <psusi ubuntu com>
Date:   Sat Feb 23 13:21:40 2013 -0500

    fixup! Add proper cancel support (#601239)
    
    Spawn the child with its own process group id so the whole group can be
    killed.

 src/FileSystem.cc |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/FileSystem.cc b/src/FileSystem.cc
index d3ad102..74cc6ed 100644
--- a/src/FileSystem.cc
+++ b/src/FileSystem.cc
@@ -69,7 +69,12 @@ static void relay_update( OperationDetail *operationdetail, Glib::ustring *str )
 static void cancel_command( bool force, Glib::Pid pid, bool cancel_safe )
 {
        if( force || cancel_safe )
-               kill( pid, SIGINT );
+               kill( -pid, SIGINT );
+}
+
+static void setup_child()
+{
+       setpgrp();
 }
 
 int FileSystem::execute_command( const Glib::ustring & command, OperationDetail & operationdetail,
@@ -86,7 +91,7 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
                        std::string(),
                        Glib::shell_parse_argv( command ),
                        Glib::SPAWN_DO_NOT_REAP_CHILD | Glib::SPAWN_SEARCH_PATH,
-                       sigc::slot< void >(),
+                       sigc::ptr_fun(setup_child),
                        &pid,
                        0,
                        &out,


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