[Title] Added to quit sub process when canceling
authordonghee yang <donghee.yang@samsung.com>
Mon, 24 Sep 2012 15:02:06 +0000 (00:02 +0900)
committerdonghee yang <donghee.yang@samsung.com>
Mon, 24 Sep 2012 15:02:06 +0000 (00:02 +0900)
src/build_server/BuildJob.rb
src/build_server/CommonJob.rb

index df3bbc2592c92b9b8c8486a6495813acf0ce3fa7..553ee8969ab45e3ac813f952dd685b9a6a92fa25 100644 (file)
@@ -173,6 +173,9 @@ class BuildJob < CommonJob
 
        #cancel
        def cancel()
+               # kill sub process if exist?
+               kill_sub_process()
+
                # cancel all its reverse job
                @server.jobmgr.reverse_build_jobs.each do |job|
                        if job.get_parent_job() == self and job.cancel_state == "NONE" then
index 45bcd595ac74300090a8a71f8c51dd71531d7d5a..7badfcff2190c0ef285efe8bb98afbe570afd74b 100644 (file)
@@ -130,7 +130,8 @@ class CommonJob
        #cancel
        public
        def cancel()
-               # do nothing
+               # kill sub process if exist?
+               kill_sub_process()
        end
 
 
@@ -167,5 +168,12 @@ class CommonJob
                # do nothing
        end
 
-
+       
+       protected
+       def kill_sub_process()
+               if @sub_pid != 0 then
+                       Process.kill("TERM", @sub_pid)
+                       Process.waitpid(@sub_pid)       
+               end
+       end
 end