mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Keep STDOUT/STDERR the right mode. Fixes #422
If you reopen STDOUT with an IO object that is "w+", then later reopen it again as just "w", you get an exception: `reopen': /dev/null can't change access mode from "w+" to "w" (ArgumentError)
This commit is contained in:
parent
a3e655aa71
commit
399c166516
1 changed files with 5 additions and 4 deletions
|
@ -13,10 +13,11 @@ module Process
|
|||
Dir.chdir "/" unless nochdir # Release old working directory.
|
||||
|
||||
if !noclose
|
||||
null = File.open "/dev/null", "w+"
|
||||
STDIN.reopen null
|
||||
STDOUT.reopen null
|
||||
STDERR.reopen null
|
||||
STDIN.reopen File.open("/dev/null", "r")
|
||||
|
||||
null_out = File.open "/dev/null", "w"
|
||||
STDOUT.reopen null_out
|
||||
STDERR.reopen null_out
|
||||
end
|
||||
|
||||
0
|
||||
|
|
Loading…
Add table
Reference in a new issue