From 2a6852c6ef272b404f97058b0afc9d460e05777c Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 9 Nov 2017 11:28:39 +0900 Subject: Correctly kill the server started with ujs test `Kernel.#spawn` execute command via the shell if contains shell metacharacters in the command. In that case, return value of `spawn` is pid of the shell, not the server. Therefore, just killing the pid will leave the process of server. In order to correctly kill the server, send a signal to the process group, not the process. --- actionview/Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview/Rakefile') diff --git a/actionview/Rakefile b/actionview/Rakefile index 9e5ef35334..8650f541b0 100644 --- a/actionview/Rakefile +++ b/actionview/Rakefile @@ -32,7 +32,7 @@ namespace :test do task :ujs do begin Dir.mkdir("log") - pid = spawn("bundle exec rackup test/ujs/config.ru -p 4567 -s puma > log/test.log 2>&1") + pid = spawn("bundle exec rackup test/ujs/config.ru -p 4567 -s puma > log/test.log 2>&1", pgroup: true) start_time = Time.now @@ -48,7 +48,7 @@ namespace :test do system("npm run lint && bundle exec ruby ../ci/qunit-selenium-runner.rb http://localhost:4567/") status = $?.exitstatus ensure - Process.kill("KILL", pid) if pid + Process.kill("KILL", -pid) if pid FileUtils.rm_rf("log") end -- cgit v1.2.3