Repository: cloudstack-cloudmonkey Updated Branches: refs/heads/master b4bf97c38 -> 76bc92b59
cloudmonkey: on error monkeyprint to stderr Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/3d081964 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/3d081964 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/3d081964 Branch: refs/heads/master Commit: 3d081964ba52552db2265a5c65465e3a5817051b Parents: b4bf97c Author: Rohit Yadav <[email protected]> Authored: Fri Oct 3 13:24:46 2014 +0200 Committer: Rohit Yadav <[email protected]> Committed: Fri Oct 3 13:24:46 2014 +0200 ---------------------------------------------------------------------- cloudmonkey/cloudmonkey.py | 2 +- cloudmonkey/printer.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/3d081964/cloudmonkey/cloudmonkey.py ---------------------------------------------------------------------- diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py index 3e67f5d..886381e 100644 --- a/cloudmonkey/cloudmonkey.py +++ b/cloudmonkey/cloudmonkey.py @@ -329,7 +329,7 @@ class CloudMonkeyShell(cmd.Cmd, object): self.print_result(result[responsekey], field_filter) print except Exception as e: - self.monkeyprint("ð Error on parsing and printing", e) + self.monkeyprint("Error on parsing and printing", e) def completedefault(self, text, line, begidx, endidx): partitions = line.partition(" ") http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/3d081964/cloudmonkey/printer.py ---------------------------------------------------------------------- diff --git a/cloudmonkey/printer.py b/cloudmonkey/printer.py index 6fe324f..e548d2c 100644 --- a/cloudmonkey/printer.py +++ b/cloudmonkey/printer.py @@ -116,4 +116,7 @@ def monkeyprint(text): lexer = MonkeyLexer() lexer.encoding = 'utf-8' fmter.encoding = 'utf-8' - highlight(text, lexer, fmter, sys.stdout) + if text.startswith("Error"): + highlight(text, lexer, fmter, sys.stderr) + else: + highlight(text, lexer, fmter, sys.stdout)
