From 7f639f145deb550e563ab3e19307b49da2e82dc0 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 10 Mar 2008 13:27:31 +0000 Subject: [PATCH] Use subprocess instead of Popen2. fixes #3369 --- src/common/helpers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common/helpers.py b/src/common/helpers.py index 4c33f9020..e6f36ab00 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -756,11 +756,10 @@ def get_os_info(): full_path_to_executable = is_in_path(executable, return_abs_path = True) if full_path_to_executable: command = executable + params - child_stdin, child_stdout = os.popen2(command) - output = temp_failure_retry(child_stdout.readline).strip() - child_stdout.close() - child_stdin.close() - os.wait() + p = Popen([command], shell=True, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, close_fds=True) + p.wait() + output = temp_failure_retry(p.stdout.readline).strip() # some distros put n/a in places, so remove those output = output.replace('n/a', '').replace('N/A', '') return output