# File lib/mcollective/shell.rb, line 62 def runcommand opts = {"env" => @environment, "stdout" => @stdout, "stderr" => @stderr, "cwd" => @cwd} opts["stdin"] = @stdin if @stdin # Running waitpid on the cid here will start a thread # with the waitpid in it, this way even if the thread # that started this process gets killed due to agent # timeout or such there will still be a waitpid waiting # for the child to exit and not leave zombies. @status = systemu(@command, opts) do |cid| begin sleep 1 Process::waitpid(cid) rescue SystemExit rescue Errno::ECHILD rescue Exception => e Log.info("Unexpected exception received while waiting for child process: #{e.class}: #{e}") end end end