From: donghee yang Date: Tue, 25 Sep 2012 01:22:18 +0000 (+0900) Subject: [Title] Fixed to support "cancel" on windows OS X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ca5145013a197741179ead4b95c3a0c07d9d6f2;p=sdk%2Ftools%2Fsdk-build.git [Title] Fixed to support "cancel" on windows OS --- diff --git a/src/common/utils.rb b/src/common/utils.rb index b3d1a6b..46a4d6e 100644 --- a/src/common/utils.rb +++ b/src/common/utils.rb @@ -539,7 +539,19 @@ class Utils def Utils.descendant_processes(base=Process.pid) descendants = Hash.new{|ht,k| ht[k]=[k]} - Hash[*`ps -eo pid,ppid`.scan(/\d+/).map{|x|x.to_i}].each{|pid,ppid| + + # generate pid => ppid hash + # NOTE. MinGW does not support "-o" option and has different output format + rel_hash = nil + os_category = get_os_category(HOST_OS) + if os_category != "windows" then + rel_hash = Hash[*`ps -eo pid,ppid`.scan(/\d+/).map{|x| x.to_i}] + else + rel_hash = Hash[*`ps -e`.scan(/^[\t\s]*(\d+)[\t\s]+(\d+)/).flatten.map{|x| x.to_i}] + end + + # make pid => all descendent processes + rel_hash.each{|pid,ppid| descendants[ppid] << descendants[pid] } return descendants[base].flatten - [base]