diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-03-31 19:18:54 +0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2015-04-01 21:08:38 +0200 |
commit | 37972d01fdfc27158de65b220912f2356fce2e65 (patch) | |
tree | 2b8af357014146079fe58a2590365952d30b1d41 | |
parent | e6f1283b73c4dfaccbaf9a117d83e98fa768144c (diff) |
Command: strip newlines from stdout/err in error msg
Strip extra linefeeds from stdout and stderr output (if captured) when
generating the error message, so that the error message itself would not
have any unwanted linefeeds.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | gbp/command_wrappers.py | 6 | ||||
-rw-r--r-- | tests/test_PristineTar.py | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py index 3e834c68..d7eb8004 100644 --- a/gbp/command_wrappers.py +++ b/gbp/command_wrappers.py @@ -105,8 +105,10 @@ class Command(object): This allows to replace stdout, stderr and err_reason in the self.run_error. """ - return self.run_error.format(stdout=self.stdout, - stderr=self.stderr, + stdout = self.stdout.rstrip() if self.stdout else self.stdout + stderr = self.stderr.rstrip() if self.stderr else self.stderr + return self.run_error.format(stdout=stdout, + stderr=stderr, err_reason=self.err_reason) def __call__(self, args=[], quiet=False): diff --git a/tests/test_PristineTar.py b/tests/test_PristineTar.py index 1e7f2dcb..150dbcfb 100644 --- a/tests/test_PristineTar.py +++ b/tests/test_PristineTar.py @@ -136,7 +136,6 @@ def test_pristine_tar_checkout_nonexistent(): ... CommandExecFailed: Pristine-tar couldn't checkout "upstream_1.1.orig.tar.gz": fatal: Path 'upstream_1.1.orig.tar.gz.delta' does not exist in 'refs/heads/pristine-tar' pristine-tar: git show refs/heads/pristine-tar:upstream_1.1.orig.tar.gz.delta failed - <BLANKLINE> """ def test_teardown(): |