diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-11-10 13:44:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-10 13:44:44 -0500 |
commit | 1482870b381b1517305c8c0aac05feb4d5b3aa6a (patch) | |
tree | f54fb77d9b87b08e6c84f2f9304cc548fa07a7f3 /lib/rack/server.rb | |
parent | 55500f93e6da1860fd63267af1f226d05d9b0bdf (diff) | |
parent | 18efbf707ea7cbc6c0e0524a8a2f6d360804a294 (diff) | |
download | rack-1482870b381b1517305c8c0aac05feb4d5b3aa6a.tar.gz |
Merge pull request #1080 from sophiedeziel/master
Prevent exception caused by a race condition on multi-threaded servers
Diffstat (limited to 'lib/rack/server.rb')
-rw-r--r-- | lib/rack/server.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rack/server.rb b/lib/rack/server.rb index 690f1096..1f37aacb 100644 --- a/lib/rack/server.rb +++ b/lib/rack/server.rb @@ -1,4 +1,5 @@ require 'optparse' +require 'fileutils' module Rack @@ -359,7 +360,7 @@ module Rack def write_pid ::File.open(options[:pid], ::File::CREAT | ::File::EXCL | ::File::WRONLY ){ |f| f.write("#{Process.pid}") } - at_exit { ::File.delete(options[:pid]) if ::File.exist?(options[:pid]) } + at_exit { ::FileUtils.rm_f(options[:pid]) } rescue Errno::EEXIST check_pid! retry |