Class: MRubyPortable::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/mruby_portable/runner.rb

Instance Method Summary collapse

Instance Method Details

#run!(command, chdir: nil) ⇒ Object

Raises:



7
8
9
10
11
12
# File 'lib/mruby_portable/runner.rb', line 7

def run!(command, chdir: nil)
  stdout, stderr, status = Open3.capture3(*command, **process_options(chdir: chdir))
  raise CommandError.new(command, stdout, stderr) unless status.success?

  [stdout, stderr]
end

#success?(command, chdir: nil) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/mruby_portable/runner.rb', line 14

def success?(command, chdir: nil)
  system(*command, **process_options(chdir: chdir, out: File::NULL, err: File::NULL))
end