Browse Source

Fix JSON output when stdout is not a terminal

When output is redirected, colourizer is not used, so character
replacements aren't needed too.
master
Kristaps Kaupe 4 years ago
parent
commit
040fb548f0
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 1
      jmbase/jmbase/support.py

1
jmbase/jmbase/support.py

@ -170,6 +170,7 @@ def jmprint(msg, level="info"):
if not level in jm_color_map.keys(): if not level in jm_color_map.keys():
raise Exception("Unsupported formatting") raise Exception("Unsupported formatting")
if sys.stdout.isatty():
# .colorize_message function does a .format() on the string, # .colorize_message function does a .format() on the string,
# which does not work with string-ified json; this should # which does not work with string-ified json; this should
# result in output as intended: # result in output as intended:

Loading…
Cancel
Save