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)