From 94bf34511c28a48ae5f548c9f50acf8ef85f5ce6 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 24 Jan 2020 14:00:44 +0100 Subject: Python: T1986: close subprocess channel Without closing the communication channel to the subprocess, Python will complain e.g. when executing vyos-smoketest binary. /usr/lib/python3/dist-packages/vyos/configsession.py:110: ResourceWarning: unclosed file <_io.BufferedReader name=3> self.__run_command([CLI_SHELL_API, 'setupSession']) ResourceWarning: Enable tracemalloc to get the object allocation traceback --- python/vyos/configsession.py | 1 + 1 file changed, 1 insertion(+) (limited to 'python/vyos/configsession.py') diff --git a/python/vyos/configsession.py b/python/vyos/configsession.py index ed6288939..163f666c2 100644 --- a/python/vyos/configsession.py +++ b/python/vyos/configsession.py @@ -121,6 +121,7 @@ class ConfigSession(object): p = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=self.__session_env) result = p.wait() output = p.stdout.read().decode() + p.communicate() if result != 0: raise ConfigSessionError(output) return output -- cgit v1.2.3