From ea82478a56447662705883482e7bfade69aa21e4 Mon Sep 17 00:00:00 2001 From: Haroon Ahmed Date: Mon, 21 Oct 2019 08:03:34 +0100 Subject: [PATCH 1/2] close file stream when reading pid from pidfile --- lib/puma/control_cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 19984961ecf8ae3d472e619160122113edf095d3 Mon Sep 17 00:00:00 2001 From: Haroon Ahmed Date: Mon, 21 Oct 2019 13:36:19 +0100 Subject: [PATCH 2/2] add changelog --- History.md | 1 + 1 file changed, 1 insertion(+) 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