Module: Testjour::RunCommand

Included in:
CLI::Run, SlaveServer
Defined in:
lib/testjour/run_command.rb

Instance Method Summary collapse

Instance Method Details

#run_command(cmd) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/testjour/run_command.rb', line 6

def run_command(cmd)
  pid_queue = Queue.new

  Thread.new do
    Thread.current.abort_on_exception = true
    status, stdout, stderr = systemu(cmd) { |pid| pid_queue << pid }
    Testjour.logger.warn stderr if stderr.strip.size > 0
  end

  pid = pid_queue.pop
  Testjour.logger.info "Started on PID #{pid}: #{cmd}"
  pid
end