lib/autobuild/subcommand.rb in autobuild-1.7.4 vs lib/autobuild/subcommand.rb in autobuild-1.7.5

- old
+ new

@@ -212,28 +212,28 @@ outread.sync = true outwrite.sync = true end cread, cwrite = IO.pipe # to control that exec goes well - if Autoproj::OSDependencies.operating_system[0].include?("windows") - olddir = Dir.pwd - if options[:working_directory] && (options[:working_directory] != Dir.pwd) - Dir.chdir(options[:working_directory]) - end - system(*command) - result=$?.success? - if(!result) - error = Autobuild::SubcommandFailed.new(target, command.join(" "), logname, "Systemcall") - error.phase = phase - raise error - end - Dir.chdir(olddir) - return - end - - cwrite.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + if Autobuild.windows? + olddir = Dir.pwd + if options[:working_directory] && (options[:working_directory] != Dir.pwd) + Dir.chdir(options[:working_directory]) + end + system(*command) + result=$?.success? + if(!result) + error = Autobuild::SubcommandFailed.new(target, command.join(" "), logname, "Systemcall") + error.phase = phase + raise error + end + Dir.chdir(olddir) + return + end + cwrite.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + pid = fork do begin if options[:working_directory] && (options[:working_directory] != Dir.pwd) Dir.chdir(options[:working_directory]) end @@ -256,10 +256,10 @@ if !input_streams.empty? pwrite.close $stdin.reopen(pread) end - exec(*command) + exec(*command, :close_others => false) rescue Errno::ENOENT cwrite.write([CONTROL_COMMAND_NOT_FOUND].pack('I')) exit(100) rescue Interrupt cwrite.write([CONTROL_INTERRUPT].pack('I'))