Commit d6059553 authored by Valentin Reis's avatar Valentin Reis

Merge branch '45-cmd-stdout-flushing' into 'master'

Resolve "`cmd` stdout flushing"

Closes #45

See merge request !78
parents 255e4bc9 d4c8aa1d
Pipeline #6462 passed with stages
in 3 minutes and 50 seconds
...@@ -83,14 +83,12 @@ class CommandLineInterface(object): ...@@ -83,14 +83,12 @@ class CommandLineInterface(object):
if msg.type == "power": if msg.type == "power":
print("%s, %s, %s" % (msg.type, time.time(), print("%s, %s, %s" % (msg.type, time.time(),
msg.total)) msg.total))
sys.stdout.flush()
if msg.type == "container_exit": if msg.type == "container_exit":
print("%s, %s, %s" % (msg.type, time.time(), print("%s, %s, %s" % (msg.type, time.time(),
msg.profile_data)) msg.profile_data))
sys.stdout.flush()
else: else:
print("%s, %s" % (msg.type, time.time())) print("%s, %s" % (msg.type, time.time()))
sys.stdout.flush() sys.stdout.flush()
print_if_filter() print_if_filter()
# if argv.uuid: # if argv.uuid:
...@@ -157,12 +155,14 @@ class CommandLineInterface(object): ...@@ -157,12 +155,14 @@ class CommandLineInterface(object):
outeof = True outeof = True
else: else:
print(msg.payload) print(msg.payload)
sys.stdout.flush()
elif msg.type == 'stderr': elif msg.type == 'stderr':
logger.debug("container msg: %r", msg) logger.debug("container msg: %r", msg)
if msg.payload == 'eof': if msg.payload == 'eof':
erreof = True erreof = True
else: else:
print(msg.payload, file=sys.stderr) print(msg.payload, file=sys.stderr)
sys.stdout.flush()
elif msg.type == 'process_exit': elif msg.type == 'process_exit':
logger.info("process ended: %r", msg) logger.info("process ended: %r", msg)
state = 'exiting' state = 'exiting'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment