Last active
August 25, 2018 20:42
-
-
Save fiveNinePlusR/317a72102a431c863784d2743ab2d87b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
#basic shell command | |
def run_command(current_command) | |
Open3.popen2e(current_command) {|stdin, stdout, wait_thr| | |
pid = wait_thr.pid # pid of the started process. | |
puts pid | |
stdout.each do |line| log line end | |
exit_status = wait_thr.value # Process::Status object returned. | |
puts "exit status '#{exit_status}'" | |
return exit_status | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment