Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

When stopping Phusion Passenger Standalone with a signal, kill 'tail'…

… processes so that they don't prevent correct shutdown.
  • Loading branch information...
commit 78abf8ab0a6359af8d36c03f64f7d1b87a4732dc 1 parent 00d2d0f
@FooBarWidget FooBarWidget authored
View
2  helper-scripts/prespawn
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# Phusion Passenger - http://www.modrails.com/
-# Copyright (c) 2010 Phusion
+# Copyright (c) 2010, 2011 Phusion
#
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
#
View
20 lib/phusion_passenger/standalone/start_command.rb
@@ -404,16 +404,20 @@ def watch_log_file(log_file)
end
IO.popen("tail -f -n #{backward} \"#{log_file}\"", "rb") do |f|
- while true
- begin
- line = f.readline
- @console_mutex.synchronize do
- STDOUT.write(line)
- STDOUT.flush
+ begin
+ while true
+ begin
+ line = f.readline
+ @console_mutex.synchronize do
+ STDOUT.write(line)
+ STDOUT.flush
+ end
+ rescue EOFError
+ break
end
- rescue EOFError
- break
end
+ ensure
+ Process.kill('TERM', f.pid)
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.