Method: MGit::System::SystemCommand#initialize

Defined in:
lib/mgit/system.rb

#initialize(cmd, opts) ⇒ SystemCommand



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mgit/system.rb', line 10

def initialize(cmd, opts)
  opts, popen_opts = extract_options(opts)
  @stdout, @stderr, @st = Open3.capture3(cmd, popen_opts)

  psystem(stdout.strip) if opts[:print_stdout]

  return if success?

  psystem(stderr.strip) if opts[:print_stderr]
  fail SystemCommandError.new(cmd, opts[:error]) if opts[:raise]
end