Module: JekyllRecker::Shell

Defined in:
lib/jekyll_recker/shell.rb

Overview

Shell

Class Method Summary collapse

Class Method Details

.run(cmd) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jekyll_recker/shell.rb', line 8

def self.run(cmd)
  out, err, status = Open3.capture3(cmd)
  return out if status.success?

  msg = <<~ERROR
    the command \`#{cmd}\` failed!
    --- exit
    #{status}
    --- stdout
    #{out}
    --- stderr
    #{err}
  ERROR

  raise msg
end