From e748f925baa85bf4e4aaec6b2d5230e88ae619ca Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 1 Nov 2023 15:49:01 -0400 Subject: [PATCH] fix: reduce unclosed IO warnings Signed-off-by: Henry Schreiner --- plumbum/commands/base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plumbum/commands/base.py b/plumbum/commands/base.py index 8f8ac0d0..47839d06 100644 --- a/plumbum/commands/base.py +++ b/plumbum/commands/base.py @@ -398,6 +398,8 @@ def popen(self, args=(), **kwargs): dstproc = self.dstcmd.popen(**kwargs) # allow p1 to receive a SIGPIPE if p2 exits srcproc.stdout.close() + if srcproc.stderr: + srcproc.stderr.close() if srcproc.stdin and src_kwargs.get("stdin") != PIPE: srcproc.stdin.close() dstproc.srcproc = srcproc