Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1023: Fix JSON output when stdout is not a terminal

040fb548f0 Fix JSON output when stdout is not a terminal (Kristaps Kaupe)

Pull request description:

  When output is redirected, colourizer is not used, so character replacements aren't needed too.

  Fixes #1022.

Top commit has no ACKs.

Tree-SHA512: 9096fa6cefca01b5f880929210116a2ff8dbe1004f60eb8e82ff7ad40345457d5d8dcd669d9f5fd0f3499d1882b296f50b0223954fcf3e2ae3bd7b3e05457c02
master
Kristaps Kaupe 4 years ago
parent
commit
44cb080213
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