diff --git a/partfinder/main.py b/partfinder/main.py index f785f7ae..53eb9021 100644 --- a/partfinder/main.py +++ b/partfinder/main.py @@ -416,7 +416,6 @@ def main(name, datatype, passed_args=None): log.error("""A program that Partitionfinder uses failed. Output follows, in case it's helpful for finding the problem""") log.error("%s", e.stdout) - log.error("%s", e.stderr) if options.show_python_exceptions or passed_args is not None: raise diff --git a/partfinder/util.py b/partfinder/util.py index 834b251c..fe440fcb 100644 --- a/partfinder/util.py +++ b/partfinder/util.py @@ -31,9 +31,9 @@ class PartitionFinderError(Exception): pass class ExternalProgramError(PartitionFinderError): - def __init__(self, stderr, stdout): - self.stderr = stderr + def __init__(self, stdout, stderr): self.stdout = stdout + self.stderr = stderr class ParseError(PartitionFinderError): pass @@ -74,13 +74,13 @@ def run_program(binary, command): shlex.split(command), shell=False, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.STDOUT) - # Capture the output, we might put it into the errors - stdout, stderr = p.communicate() - # p.terminate() + err = p.wait() - if p.returncode != 0: + if err: + # Capture the output to put into the error + stdout, stderr = p.communicate() raise ExternalProgramError(stdout, stderr) def dupfile(src, dst):