Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Let cuke4php_server shut down gracefully (and call registered shutdow…

…n functions) rather than killing it. Useful when your step definitions create expensive state (like a Webdriver session).
  • Loading branch information...
commit 4623231520718f63b66d788ac67387f58beaad00 1 parent b1ed3a0
@sminnee sminnee authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 bin/cuke4php
View
10 bin/cuke4php
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.