From bd657de06a710bfa35d2790f9d22e45d20491883 Mon Sep 17 00:00:00 2001 From: Olivier Vielpeau Date: Fri, 13 Apr 2018 16:12:45 +0200 Subject: [PATCH] [subprocess_output] Add compatibility layer with datadog_checks_base (#3723) --- utils/subprocess_output.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/utils/subprocess_output.py b/utils/subprocess_output.py index 6b3aca6fbe..735dae7067 100644 --- a/utils/subprocess_output.py +++ b/utils/subprocess_output.py @@ -20,6 +20,14 @@ def get_subprocess_output(command, log, raise_on_empty_output=True): Run the given subprocess command and return its output. Raise an Exception if an error occurs. """ + return subprocess_output(command, raise_on_empty_output) + + +def subprocess_output(command, raise_on_empty_output): + """ + Run the given subprocess command and return its output. This is a private method + and should not be called directly, use `get_subprocess_output` instead. + """ # Use tempfile, allowing a larger amount of memory. The subprocess.Popen # docs warn that the data read is buffered in memory. They suggest not to @@ -29,9 +37,6 @@ def get_subprocess_output(command, log, raise_on_empty_output=True): proc.wait() stderr_f.seek(0) err = stderr_f.read() - if err: - log.debug("Error while running {0} : {1}".format(" ".join(command), err)) - stdout_f.seek(0) output = stdout_f.read()