Module: Run

Included in:
AlsDelta
Defined in:
lib/common/run.rb

Instance Method Summary collapse

Instance Method Details

#run(command) ⇒ Object

Returns true if the command succeeded.

Returns:

  • true if the command succeeded



5
6
7
8
9
# File 'lib/common/run.rb', line 5

def run(command)
  # printf "Run #{command}\n".yellow
  $stdout.sync = true
  system(*command)
end

#run_capture_stdout(command) ⇒ Object

Returns String array containing resulting lines of running command.

Returns:

  • String array containing resulting lines of running command



12
13
14
15
16
17
18
19
20
# File 'lib/common/run.rb', line 12

def run_capture_stdout(command)
  # printf "Run #{command}\n".yellow
  stdout_str, status = Open3.capture2 command
  unless status.success?
    printf "Error: #{command} returned #{status}"
    exit status.to_i
  end
  stdout_str.strip.split
end