build_command = "cd \"#{working_dir}\";#{@server.git_bin_path} #{cmd}"
pid, status = execute_command( build_command )
- if status.exitstatus != 0 then
+ if not status.nil? and status.exitstatus != 0 then
return false
else
return true
@host_os = Utils::HOST_OS
@buildroot_dir = buildroot_dir
@cache_dir = cache_dir
+ @job = nil
if not log_path.nil? then
@log = Log.new(log_path)
else
pid, status = Utils.execute_shell_with_log( build_command, @log.path )
end
- if status.exitstatus != 0 then
+ if not status.nil? and status.exitstatus != 0 then
@log.error( "Failed on build script: \"#{target}\"", Log::LV_USER)
return false
else
# create logger
if log_path.nil? or log_path.empty? then
- log = Logger.new(STDOUT)
+ log = DummyLog.new
else
log = Logger.new(log_path)
end
# can decide whether wait or not
def Utils.execute_shell_with_log(cmd, log_path, wait=true)
+ if log_path.nil? or log_path.empty? then
+ return execute_shell_with_stdout(cmd, nil)
+ end
+
ruby_path=File.join(Config::CONFIG["bindir"],
Config::CONFIG["RUBY_INSTALL_NAME"] +
Config::CONFIG["EXEEXT"])
end
+ def Utils.execute_shell_with_stdout(cmd, os_category = nil)
+
+ logger = Logger.new(STDOUT)
+
+ # generate command
+ cmd = generate_shell_command(cmd, os_category)
+
+ # print log
+ pipe = IO.popen("#{cmd} 2>&1") { |io|
+ io.each do |line|
+ logger.info line
+ end
+ }
+
+ return [nil, nil]
+ end
+
+
def Utils.spawn(cmd, os_category = nil)
if os_category.nil? then os_category = get_os_category( HOST_OS ) end
logger.info "Downloading #{url}"
if is_remote then
pid,status = Utils.execute_shell_with_log( "wget #{url} -O #{fullpath} -nv", logger.path )
- ret = status.exitstatus != 0 ? false : true
+ ret = (not status.nil? and status.exitstatus) != 0 ? false : true
#ret = Utils.execute_shell( "wget #{url} -O #{fullpath} -q")
else
if not File.exist? url then