From f5707a48e4b11fcedf505bc119959cfcdf66c9e4 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 15 Oct 2020 16:06:00 +0200 Subject: [PATCH] _subprocess is returning full output with stderr and stdout --- pype/lib.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pype/lib.py b/pype/lib.py index 978386af3a..5fb9091cc1 100644 --- a/pype/lib.py +++ b/pype/lib.py @@ -101,20 +101,26 @@ def _subprocess(*args, logger=None, **kwargs): proc = subprocess.Popen(*args, **kwargs) + full_output = "" _stdout, _stderr = proc.communicate() if _stdout: _stdout = _stdout.decode("utf-8") + full_output += _stdout logger.debug(_stdout) if _stderr: _stderr = _stderr.decode("utf-8") + # Add additional line break if output already containt stdout + if full_output: + full_output += "\n" + full_output += _stderr logger.warning(_stderr) if proc.returncode != 0: raise ValueError( "\"{}\" was not successful:\nOutput: {}\nError: {}".format( args, output, error)) - return output + return full_output def get_hierarchy(asset_name=None):