Przeglądaj źródła

Fix the printing of a color reset code at exit even when color is disabled (#956).

Dan Helfman 5 miesięcy temu
rodzic
commit
0844cd0d4f
2 zmienionych plików z 5 dodań i 1 usunięć
  1. 1 0
      NEWS
  2. 4 1
      borgmatic/commands/borgmatic.py

+ 1 - 0
NEWS

@@ -2,6 +2,7 @@
  * #947: To avoid a hang in the database hooks, error and exit when the borgmatic runtime
  * #947: To avoid a hang in the database hooks, error and exit when the borgmatic runtime
    directory overlaps with the configured excludes.
    directory overlaps with the configured excludes.
  * #954: Fix findmnt command error in the Btrfs hook by switching to parsing JSON output.
  * #954: Fix findmnt command error in the Btrfs hook by switching to parsing JSON output.
+ * #956: Fix the printing of a color reset code at exit even when color is disabled.
  * When the ZFS, Btrfs, or LVM hooks aren't configured, don't try to cleanup snapshots for them.
  * When the ZFS, Btrfs, or LVM hooks aren't configured, don't try to cleanup snapshots for them.
 
 
 1.9.4
 1.9.4

+ 4 - 1
borgmatic/commands/borgmatic.py

@@ -915,7 +915,10 @@ def main(extra_summary_logs=[]):  # pragma: no cover
         getattr(sub_arguments, 'json', False) for sub_arguments in arguments.values()
         getattr(sub_arguments, 'json', False) for sub_arguments in arguments.values()
     )
     )
     color_enabled = should_do_markup(global_arguments.no_color or any_json_flags, configs)
     color_enabled = should_do_markup(global_arguments.no_color or any_json_flags, configs)
-    colorama.init(autoreset=color_enabled, strip=not color_enabled)
+
+    if color_enabled:
+        colorama.init(autoreset=True)
+
     try:
     try:
         configure_logging(
         configure_logging(
             verbosity_to_log_level(global_arguments.verbosity),
             verbosity_to_log_level(global_arguments.verbosity),