aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/Rakefile
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-11-09 11:28:39 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-11-09 11:34:05 +0900
commit2a6852c6ef272b404f97058b0afc9d460e05777c (patch)
treeb7653f191c2b57bb35550310d53517302012c484 /actionview/Rakefile
parent89603b41edbaaed5cab4964a30caa8bda9285879 (diff)
downloadrails-2a6852c6ef272b404f97058b0afc9d460e05777c.tar.gz
rails-2a6852c6ef272b404f97058b0afc9d460e05777c.tar.bz2
rails-2a6852c6ef272b404f97058b0afc9d460e05777c.zip
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.
Diffstat (limited to 'actionview/Rakefile')
-rw-r--r--actionview/Rakefile4
1 files changed, 2 insertions, 2 deletions
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