mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
89603b41ed
commit
2a6852c6ef
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue