From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH v2 5/5] unbound-dhcp-leases-bridge: Don't open stderr on daemonization Date: Wed, 30 Mar 2022 09:56:35 +0000 Message-ID: <20220330095635.621181-5-michael.tremer@ipfire.org> In-Reply-To: <20220330095635.621181-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3596275688364991365==" List-Id: --===============3596275688364991365== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Michael Tremer --- config/unbound/unbound-dhcp-leases-bridge | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/config/unbound/unbound-dhcp-leases-bridge b/config/unbound/unbou= nd-dhcp-leases-bridge index 50a0e516a..1446c88df 100644 --- a/config/unbound/unbound-dhcp-leases-bridge +++ b/config/unbound/unbound-dhcp-leases-bridge @@ -618,13 +618,14 @@ if __name__ =3D=3D "__main__": bridge =3D UnboundDHCPLeasesBridge(args.dhcp_leases, args.fix_leases, args.unbound_leases, args.hosts) =20 - ctx =3D daemon.DaemonContext(detach_process=3Dargs.daemon, stderr=3Dsys.std= err) - ctx.signal_map =3D { - signal.SIGHUP : bridge.update_dhcp_leases, - signal.SIGTERM : bridge.terminate, - } - - with ctx: + with daemon.DaemonContext( + detach_process=3Dargs.daemon, + stderr=3DNone if args.daemon else sys.stderr, + signal_map =3D { + signal.SIGHUP : bridge.update_dhcp_leases, + signal.SIGTERM : bridge.terminate, + }, + ) as daemon: setup_logging(daemon=3Dargs.daemon, loglevel=3Dloglevel) =20 bridge.run() --=20 2.30.2 --===============3596275688364991365==--