Skip to content

Commit 73cf92a

Browse files
author
Tim Vaillancourt
committed
stderr/stdout shouldn't be class vars now that they're just pieces of the buffer
1 parent 2049152 commit 73cf92a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

MongoBackup/Common/LocalCommand.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ def __init__(self, command, command_flags=[], verbose=False):
1111
self.verbose = verbose
1212

1313
self.output = []
14-
self.stdout = None
15-
self.stderr = None
1614
self._process = None
1715

1816
self.command_line = [self.command]
@@ -22,10 +20,10 @@ def __init__(self, command, command_flags=[], verbose=False):
2220
def parse_output(self):
2321
if self._process:
2422
try:
25-
self.stdout, self.stderr = self._process.communicate()
26-
output = self.stdout.strip()
27-
if output == "" and self.stderr.strip() != "":
28-
output = self.stderr.strip()
23+
stdout, stderr = self._process.communicate()
24+
output = stdout.strip()
25+
if output == "" and stderr.strip() != "":
26+
output = stderr.strip()
2927
if not output == "":
3028
self.output.append("\n\t".join(output.split("\n")))
3129
except Exception, e:
@@ -45,7 +43,7 @@ def run(self):
4543
raise Exception, "%s command failed with exit code %i! Stderr output:\n%s" % (
4644
self.command,
4745
self._process.returncode,
48-
self.stderr.strip()
46+
"\n".join(self.output)
4947
), None
5048
elif self.verbose:
5149
if len(self.output) > 0:

0 commit comments

Comments
 (0)