module OrangeLib::CommandLine

Public Instance Methods

execute_command(command) click to toggle source

Execute a command line @param [String] command command @return [String] String of output which will be print on screen when we execute the comman @example

execute_command('echo $PATH')
# File lib/orange_lib/command_line.rb, line 10
def execute_command(command)
  output = ''
  Open3.popen2e(command) {|stdin, stdout_and_stderr, wait_thr|
    stdout_and_stderr.each{|line|
      puts line
      output << line
    }
  }
  output
end