Module: Phut::ShellRunner

Included in:
Link, Netns, Netns, OpenVswitch, OpenVswitch, Route, Route, Veth, Vhost, Vsctl, Vsctl
Defined in:
lib/phut/shell_runner.rb

Overview

Provides sh method.

Instance Method Summary collapse

Instance Method Details

#sh(command) ⇒ Object



13
14
15
16
17
18
# File 'lib/phut/shell_runner.rb', line 13

def sh(command)
  Phut.logger.debug(command)
  stdout, stderr, status = Open3.capture3(command)
  raise %(Command '#{command}' failed: #{stderr}) unless status.success?
  stdout
end

#sudo(command) ⇒ Object



9
10
11
# File 'lib/phut/shell_runner.rb', line 9

def sudo(command)
  sh "sudo #{command}"
end