Module: Nito::Sudo
- Defined in:
- lib/nito/sudo.rb
Class Method Summary collapse
Class Method Details
.run(command, input = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/nito/sudo.rb', line 3 def self.run(command, input = nil) #IO.popen("sudo -S #{command}", 'r+') do |io| IO.popen("sudo #{command}", 'r+') do |io| begin io.puts input io.close_write io.read rescue Interrupt puts "\nInterrupt" end end end |