Top Level Namespace

Defined Under Namespace

Modules: BenchTool, DeepSymbolizable Classes: Hash

Instance Method Summary collapse

Instance Method Details

#console(msg) ⇒ Object

Writes msg to STDERR (helps with bash shell redirection)



2
3
4
# File 'lib/benchtool/helpers.rb', line 2

def console(msg)
  STDERR.puts msg
end

#run_shell_cmd(cmd) ⇒ Object

PTY version (writes to output in real time)



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/benchtool/helpers.rb', line 18

def run_shell_cmd(cmd)
  begin
    PTY.spawn(cmd) do |r, w, pid|
      begin
        r.each { |line| print line;}
      rescue Errno::EIO
      rescue Interrupt
        console ""
        console "Goodbye!"
      end
    end
  rescue PTY::ChildExited => e
    puts "The child process exited!"
  end
end