changeset 48415:9ff246cd6200

rhg: don't run `blackbox` if not activated You currently have no way of turning off blackbox. Aside from being a bug, this can be annoying if you use `rhg` in your shell prompt, but also because the current implementation of blackbox is quite slow due to `user` querying. Differential Revision: https://phab.mercurial-scm.org/D11813
author Raphaël Gomès <rgomes@octobus.net>
date Fri, 26 Nov 2021 15:07:59 +0100
parents 1d940d76571b
children c1b633db67fc
files rust/rhg/src/main.rs
diffstat 1 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/rust/rhg/src/main.rs	Fri Nov 26 15:05:58 2021 +0100
+++ b/rust/rhg/src/main.rs	Fri Nov 26 15:07:59 2021 +0100
@@ -110,18 +110,23 @@
         }
     }
 
-    let blackbox = blackbox::Blackbox::new(&invocation, process_start_time)?;
-    blackbox.log_command_start();
-    let result = run(&invocation);
-    blackbox.log_command_end(exit_code(
-        &result,
-        // TODO: show a warning or combine with original error if `get_bool`
-        // returns an error
-        config
-            .get_bool(b"ui", b"detailed-exit-code")
-            .unwrap_or(false),
-    ));
-    result
+    if config.is_extension_enabled(b"blackbox") {
+        let blackbox =
+            blackbox::Blackbox::new(&invocation, process_start_time)?;
+        blackbox.log_command_start();
+        let result = run(&invocation);
+        blackbox.log_command_end(exit_code(
+            &result,
+            // TODO: show a warning or combine with original error if
+            // `get_bool` returns an error
+            config
+                .get_bool(b"ui", b"detailed-exit-code")
+                .unwrap_or(false),
+        ));
+        result
+    } else {
+        run(&invocation)
+    }
 }
 
 fn main() {