Module: UIAutoMonkey::CommandHelper

Included in:
MonkeyRunner
Defined in:
lib/crash_monkey/command_helper.rb

Instance Method Summary collapse

Instance Method Details

#kill_all(process_name, signal = nil) ⇒ Object



18
19
20
21
# File 'lib/crash_monkey/command_helper.rb', line 18

def kill_all(process_name, signal=nil)
  signal = signal ? "-#{signal}" : ''
  Kernel.system("killall #{signal} '#{process_name}'")
end

#run_process(cmds) ⇒ Object



13
14
15
16
# File 'lib/crash_monkey/command_helper.rb', line 13

def run_process(cmds)
  puts "Run: #{cmds.inspect}"
  Kernel.system(cmds[0], *cmds[1..-1])
end

#shell(cmds) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/crash_monkey/command_helper.rb', line 5

def shell(cmds)
  puts "Shell: #{cmds.inspect}"
  Open3.popen3(*cmds) do |stdin, stdout, stderr|
    stdin.close
    return stdout.read
  end
end

#xcode_pathObject



23
24
25
# File 'lib/crash_monkey/command_helper.rb', line 23

def xcode_path
  @xcode_path ||= shell(%w(xcode-select -print-path)).strip
end