From: donghee yang Date: Fri, 21 Sep 2012 17:05:27 +0000 (+0900) Subject: [Title] Rollback "execute_with_log" on windows X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=70d88c244f7e5a067e7a8858bb5029b42afdd657;p=sdk%2Ftools%2Fsdk-build.git [Title] Rollback "execute_with_log" on windows --- diff --git a/src/common/utils.rb b/src/common/utils.rb index e74e27d..70ee2ad 100644 --- a/src/common/utils.rb +++ b/src/common/utils.rb @@ -198,18 +198,32 @@ class Utils # can decide whether wait or not def Utils.execute_shell_with_log(cmd, log_path, wait=true) - # call execute - cmd = "'#{File.dirname(__FILE__)}/execute_with_log' '#{cmd}' '#{log_path}'" + if get_os_category( HOST_OS ) != "windows" then + # call execute + cmd = "'#{File.dirname(__FILE__)}/execute_with_log' '#{cmd}' '#{log_path}'" - # generate command - cmd = generate_shell_command(cmd, nil) + # generate command + cmd = generate_shell_command(cmd, nil) - # print log - pipe = IO.popen("#{cmd} 2>&1") - if wait then - return Process.waitpid2(pipe.pid) + # print log + pipe = IO.popen("#{cmd} 2>&1") + if wait then + return Process.waitpid2(pipe.pid) + else + return [pipe.pid,nil] + end else - return [pipe.pid,nil] + # create logger + log = Logger.new(log_path) + + IO.popen("#{cmd} 2>&1") { |io| + io.each { |line| + log.info line + } + } + + # return exit code + return [nil, $?] end end