Class: Gordon::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/gordon/process.rb

Class Method Summary collapse

Class Method Details

.run(command) ⇒ Object

Raises:

  • (SystemCallError)


3
4
5
6
7
8
9
10
# File 'lib/gordon/process.rb', line 3

def self.run(command)
  pid = ::Process.spawn(command, out: $stdout, err: $stderr)
  _, exit_status = ::Process.wait2(pid)

  raise SystemCallError.new("Failed to execute [#{command}]. Exit code: #{exit_status}") unless exit_status == 0

  true
end