diff --git a/History.md b/History.md index 936b0116c6..065e4cd5fa 100644 --- a/History.md +++ b/History.md @@ -7,6 +7,7 @@ * Bugfixes * Fix Errno::EINVAL when SSL is enabled and browser rejects cert (#1564) * Fix pumactl defaulting puma to development if an environment was not specified (#2035) + * Fix closing file stream when reading pid from pidfile (#2048) ## 4.2.1 / 2019-10-07 diff --git a/lib/puma/control_cli.rb b/lib/puma/control_cli.rb index 8eee72f5d3..6bad828b88 100644 --- a/lib/puma/control_cli.rb +++ b/lib/puma/control_cli.rb @@ -132,7 +132,7 @@ def prepare_configuration @pid = sf.pid elsif @pidfile # get pid from pid_file - @pid = File.open(@pidfile).gets.to_i + File.open(@pidfile) { |f| @pid = f.read.to_i } end end