Skip to content

Commit 435d3c5

Browse files
committed
find and kill the pid on 8080
1 parent e55dd83 commit 435d3c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/support/webpacker_helpers.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ def with_dev_server
8989
ensure
9090
# Kill the server process
9191
puts "Killing webpack dev server"
92-
puts Process.kill("INT", webpack_dev_server)
93-
Process.wait(webpack_dev_server)
94-
puts $?
9592
check_cmd = "lsof -i :8080 -S"
9693
kill_cmd = "kill -9 #{webpack_dev_server}"
94+
`#{kill_cmd}`
9795
30.times do
9896
puts check_cmd
9997
status = `#{check_cmd}`
10098
puts status
10199
still_alive = status.include?(webpack_dev_server.to_s)
102100
puts "Still alive? #{still_alive} (#{webpack_dev_server.to_s})"
103101
if still_alive
102+
remaining_pid = status.match(/\n[a-z]+\s+(\d+)/)[1]
103+
kill_cmd = "kill -9 #{remaining_pid}"
104104
puts kill_cmd
105105
puts `#{kill_cmd}`
106106
sleep 0.5

0 commit comments

Comments
 (0)