[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.44-689-gbf31baf
Andreas Beckmann
debian at abeckmann.de
Sun Jun 10 11:10:11 UTC 2012
The following commit has been merged in the piatti branch:
commit 2717e8373a00f459305300da44a7df862124e6ab
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Mon Jun 4 22:17:09 2012 +0200
p: run(): reindent for exception handling
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/piuparts.py b/piuparts.py
index df031e2..df960fb 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -411,17 +411,20 @@ def run(command, ignore_errors=False):
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = ""
excessive_output = False
- while p.poll() is None:
- """Read 64 KB chunks, but depending on the output buffering behavior
- of the command we may get less even if more output is coming later.
- Abort after reading 2 MB."""
- output += p.stdout.read(1 << 16)
- if (len(output) > settings.max_command_output_size):
- excessive_output = True
- kill_subprocess(p, "excessive output")
- break
- if not excessive_output:
- output += p.stdout.read(settings.max_command_output_size)
+ try:
+ while p.poll() is None:
+ """Read 64 KB chunks, but depending on the output buffering behavior
+ of the command we may get less even if more output is coming later.
+ Abort after reading max_command_output_size bytes."""
+ output += p.stdout.read(1 << 16)
+ if (len(output) > settings.max_command_output_size):
+ excessive_output = True
+ kill_subprocess(p, "excessive output")
+ break
+ if not excessive_output:
+ output += p.stdout.read(settings.max_command_output_size)
+ except None:
+ pass
devnull.close()
if output:
--
piuparts git repository
More information about the Piuparts-commits
mailing list