Method: CommandRunner#run_local
- Defined in:
- lib/protk/command_runner.rb
#run_local(command_string) ⇒ Object
Runs the given command in a local shell
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/protk/command_runner.rb', line 30 def run_local(command_string) @env.log("Command: #{command_string} started",:info) status = Open4::popen4("#{command_string} ") do |pid, stdin, stdout, stderr| @env.log "PID #{pid}" , :info stdout.each { |line| @env.log(line.chomp,:info) } stderr.each { |line| @env.log(line.chomp,:warn) } end if ( status!=0 ) # We terminated with some error code so log as an error @env.log( "Command: #{command_string} exited with status #{status.to_s}",:error) else @env.log( "Command: #{command_string} exited with status #{status.to_s}",:info) end status end |