Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Let cuke4php_server shut down gracefully (and call registered shutdow…
Browse files Browse the repository at this point in the history
…n functions) rather than killing it. Useful when your step definitions create expensive state (like a Webdriver session).
  • Loading branch information
Sam Minnee committed Jan 19, 2012
1 parent b1ed3a0 commit 4623231
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bin/cuke4php
Expand Up @@ -51,5 +51,13 @@ cucumber = fork do
exec "export CUKE4PHP_PORT=#{cuke4php_port} && cucumber #{ARGV.join(' ')}"
end
pid, status = Process.wait2(cucumber,0)
Process.kill("TERM",server)

# Send the "bye" status to the cuke4php server
cuke4php_sock = TCPSocket.open('localhost', cuke4php_port)
cuke4php_sock.puts "bye\n"
cuke4php_sock.close

# Wait for it to close
Process.wait(server)

exit status.exitstatus

0 comments on commit 4623231

Please sign in to comment.