Method: Exec#run_cmd!
- Defined in:
- lib/oxidized/hook/exec.rb
#run_cmd!(env) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/oxidized/hook/exec.rb', line 45 def run_cmd! env pid, status = nil, nil Timeout.timeout(@timeout) do pid = spawn env, @cmd , :unsetenv_others => true pid, status = wait2 pid unless status.exitstatus.zero? msg = "#{@cmd.inspect} failed with exit value #{status.exitstatus}" log msg, :error raise msg end end rescue TimeoutError kill "TERM", pid msg = "#{@cmd} timed out" log msg, :error raise TimeoutError, msg end |