Module: ParallelCalabash::Runner

Included in:
AndroidRunner, IosRunner
Defined in:
lib/parallel_calabash/runner.rb

Instance Method Summary collapse

Instance Method Details

#execute_command_for_process(process_number, cmd) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/parallel_calabash/runner.rb', line 6

def execute_command_for_process(process_number, cmd)
  output = open("|#{cmd}", 'r') { |output| show_output(output, process_number) }
  exitstatus = $?.exitstatus

  if @silence
    $stdout.print output
    $stdout.flush
  end
  puts "\n****** PROCESS #{process_number} COMPLETED ******\n\n"
  {:stdout => output, :exit_status => exitstatus}
end

#show_output(output, process_number) ⇒ Object



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

def show_output(output, process_number)
  result = ''
  loop do
    begin
      unless @silence
        read = output.readline()
        $stdout.print "#{process_number}> #{read}"
        $stdout.flush
      else
        read = output.readpartial(1000000) # read whatever chunk we can get
      end
      result << read
    end
  end rescue EOFError
  result
end