diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-04-01 16:22:34 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-04-01 16:22:34 +0300 |
commit | fd9865d5fe7cd7170f426f2473048edd8ec1a2a1 (patch) | |
tree | 22f4ff22ad96eefb42a24a74ae33c52f0418c0c0 | |
parent | 5301e64f8c609dee0968c826272398386c61f605 (diff) | |
download | vmdb2-fd9865d5fe7cd7170f426f2473048edd8ec1a2a1.tar.gz |
Produce progress report even without tty
Without this, ./check would fail, because no output was being
produced. Now with -v stdout gets written even if ttystatus is
of the opinion there's nothing to do because tty isn't there.
-rw-r--r-- | vmdb/runcmd.py | 4 | ||||
-rw-r--r-- | yarns/100-mvp.yarn | 8 | ||||
-rw-r--r-- | yarns/lib.py | 1 |
3 files changed, 8 insertions, 5 deletions
diff --git a/vmdb/runcmd.py b/vmdb/runcmd.py index f3c59cf..7534e7d 100644 --- a/vmdb/runcmd.py +++ b/vmdb/runcmd.py @@ -37,7 +37,9 @@ def progress(msg): logging.info(msg) _progress['current'] = msg if _verbose: - _progress.notify(msg.rstrip()) + sys.stdout.write(msg) + if not msg.endswith('\n'): + sys.stdout.write('\n') def runcmd(argv, *argvs, **kwargs): diff --git a/yarns/100-mvp.yarn b/yarns/100-mvp.yarn index 77f3db2..4a01b47 100644 --- a/yarns/100-mvp.yarn +++ b/yarns/100-mvp.yarn @@ -106,7 +106,7 @@ the step mounts a filesystem, the teardown would unmount it. ... { echo: "bar", teardown: "bar_teardown" } ... ] ... } - WHEN user runs vmdb2 happy.vmdb + WHEN user runs vmdb2 -v happy.vmdb THEN exit code is 0 AND stdout contains "foo" followed by "bar" AND stdout contains "bar" followed by "bar_teardown" @@ -127,11 +127,11 @@ specification file would instead do thing like create the file. GIVEN a specification file called j2.vmdb containing ... { ... steps: [ - ... { echo: "image is {{ image }}" }, + ... { echo: "image is {{ output }}" }, ... { echo: "bar" }, ... ] ... } - WHEN user runs vmdb2 --image=foo.img j2.vmdb + WHEN user runs vmdb2 -v --output=foo.img j2.vmdb THEN exit code is 0 AND stdout contains "image is foo.img" followed by "bar" @@ -151,7 +151,7 @@ then? ... { echo: "bar_step", teardown: "bar_teardown" } ... ] ... } - WHEN user runs vmdb2 unhappy.vmdb + WHEN user runs vmdb2 -v unhappy.vmdb THEN exit code is 1 AND stdout contains "foo" followed by "yikes" AND stdout contains "yikes" followed by "WAT?!" diff --git a/yarns/lib.py b/yarns/lib.py index fe39735..5ce05fa 100644 --- a/yarns/lib.py +++ b/yarns/lib.py @@ -1,4 +1,5 @@ import os +import sys import cliapp |