From ebf1e8fc1f55c326c74b75c7f14682ac329808d8 Mon Sep 17 00:00:00 2001 From: Lodewijk Nauta Date: Wed, 4 Sep 2024 15:55:20 +0200 Subject: [PATCH] Fix execute proc fn --- picas/executers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/picas/executers.py b/picas/executers.py index dbb454a..2475f05 100644 --- a/picas/executers.py +++ b/picas/executers.py @@ -16,9 +16,9 @@ def execute(args, shell=False): @param args: the arguments as they need to be specified for Popen. @return: a tuple containing the exitcode, stdout & stderr """ - proc = Popen(args, stdout=PIPE, stderr=PIPE, shell=shell) - (stdout, stderr) = proc.communicate() - return (proc, proc.returncode, stdout, stderr) + with Popen(args, stdout=PIPE, stderr=PIPE, shell=shell) as proc: + (stdout, stderr) = proc.communicate() + return (proc.returncode, stdout, stderr)