Reputation: 1843
This is my code snippet
def execution_start
puts "About to start"
system("appium")
puts "Done!!"
end
When executing this I see the output About to start
, and appium server is launched. But after that, I do not see anything happening. It's stuck forever. Any idea?
Upvotes: 1
Views: 43
Reputation: 35803
system
blocks until the command it runs has completed. To run a command and return immediately, use Process#spawn
:
def execution_start
puts "About to start"
pid = Process.spawn("appium")
puts "Done!!"
end
You can then use the returned PID to monitor whether the process has finished executing, and with what exit code, later in your program.
(Note that, per the documentation, you need to Process#wait
the PID eventually, or at least register disinterest using Process#detach
to prevent the subprocess from becoming a zombie.)
Upvotes: 5