You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by st...@apache.org on 2014/11/02 15:25:20 UTC
[08/50] git commit: SLIDER-584 flush output after every line and at
the end of the run
SLIDER-584 flush output after every line and at the end of the run
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/2826027e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/2826027e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/2826027e
Branch: refs/heads/feature/SLIDER-531-registry-enhancements
Commit: 2826027e260b9d278769eb22a87d37238eb4419a
Parents: 035dbe7
Author: Steve Loughran <st...@apache.org>
Authored: Thu Oct 30 13:18:03 2014 +0000
Committer: Steve Loughran <st...@apache.org>
Committed: Thu Oct 30 13:18:03 2014 +0000
----------------------------------------------------------------------
slider-assembly/src/main/scripts/slider.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/2826027e/slider-assembly/src/main/scripts/slider.py
----------------------------------------------------------------------
diff --git a/slider-assembly/src/main/scripts/slider.py b/slider-assembly/src/main/scripts/slider.py
index 38ff68d..e67a6ff 100644
--- a/slider-assembly/src/main/scripts/slider.py
+++ b/slider-assembly/src/main/scripts/slider.py
@@ -122,6 +122,17 @@ def out(toStdErr, text) :
else:
sys.stdout.write(text)
+def flush(toStdErr) :
+ """
+ Flush the output stream
+ :param toStdErr: flag set if stderr is to be the dest
+ :return:
+ """
+ if toStdErr:
+ sys.stderr.flush()
+ else:
+ sys.stdout.flush()
+
def read(pipe, line):
"""
read a char, append to the listing if there is a char that is not \n
@@ -147,6 +158,7 @@ def print_output(name, src, toStdErr):
Relay the output stream to stdout line by line
:param name:
:param src: source stream
+ :param toStdErr: flag set if stderr is to be the dest
:return:
"""
@@ -156,13 +168,16 @@ def print_output(name, src, toStdErr):
(line, done) = read(src, line)
if done:
out(toStdErr, line + "\n")
+ flush(toStdErr)
line = ""
# closedown: read remainder of stream
c = src.read(1)
while c!="" :
out(toStdErr, c)
+ if c == "\n":
+ flush(toStdErr)
c = src.read(1)
-
+ flush(toStdErr)
src.close()