diff options
author | Mike McLean <mikem redhat com> | 2008-11-11 16:49:25 -0600 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2008-11-11 16:49:25 -0600 |
commit | 9eb2dc48fb1097416a42fe4835274b9c4d8a9ad9 (patch) | |
tree | f097a065da2efa68849d1090db35c613bcd81afa /py/mock | |
parent | f361fde09b4063026dc1e644511db3041dec275d (diff) | |
download | mock-9eb2dc48fb1097416a42fe4835274b9c4d8a9ad9.tar.gz mock-9eb2dc48fb1097416a42fe4835274b9c4d8a9ad9.tar.xz mock-9eb2dc48fb1097416a42fe4835274b9c4d8a9ad9.zip |
Signed-off-by: Mike McLean <mikem redhat com>
Diffstat (limited to 'py/mock')
-rw-r--r-- | py/mock/util.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/py/mock/util.py b/py/mock/util.py index 44b32d6..42f7ba6 100644 --- a/py/mock/util.py +++ b/py/mock/util.py @@ -233,6 +233,7 @@ def logOutput(fds, logger, returnOutput=1, start=0, timeout=0): if not fd.closed: fcntl.fcntl(fd, fcntl.F_SETFL, flags| os.O_NONBLOCK) + tail = "" while not done: if (time.time() - start)>timeout and timeout!=0: done = 1 @@ -246,13 +247,20 @@ def logOutput(fds, logger, returnOutput=1, start=0, timeout=0): done = 1 break if logger is not None: - for line in input.split("\n"): + lines = input.split("\n") + if tail: + lines[0] = tail + lines[0] + # we may not have all of the last line + tail = lines.pop() + for line in lines: if line == '': continue - logger.debug(chomp(line)) + logger.debug(line) for h in logger.handlers: h.flush() if returnOutput: output += input + if tail and logger is not None: + logger.debug(tail) return output # logger = |