# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1644423411 -3600
#      Wed Feb 09 17:16:51 2022 +0100
# Node ID 26080da93815ff0977915e6cf256af85f10e0b2e
# Parent  52997affe73611155ca5eecc715595eba6786e81
do not always accept failing command

diff --git a/bin/run-util b/bin/run-util
--- a/bin/run-util
+++ b/bin/run-util
@@ -26,9 +26,11 @@
         self.base_command = get_var('command')
         self.command = None
 
+        # XXX having a list of acceptable status would be better (default to [0])
+        self.accept_failure = bool(get_var('accept-failure'))
+
         self.cwd = get_var('cwd')
 
-
     def apply_data_env(self, data_env_data):
         variables_data = self._benchmark_data['simple-command'].get('variables')
 
@@ -100,6 +102,8 @@
             "--",
             cmd.command,
         ]
+        if cmd.accept_failure:
+            time_cmd.insert(-2, "--ignore-failure")
 
         cwd = data_env_path
         if cmd.cwd is not None:
diff --git a/tests/test-simple-run.t b/tests/test-simple-run.t
--- a/tests/test-simple-run.t
+++ b/tests/test-simple-run.t
@@ -74,6 +74,7 @@
   $ env-desc set black-tiny-bad.pbd meta.name black.check.tiny
   $ env-desc set black-tiny-bad.pbd meta.method simple-command
   $ env-desc set black-tiny-bad.pbd simple-command.command "black --check {file}"
+  $ env-desc set black-tiny-bad.pbd simple-command.accept-failure "1"
   $ env-desc set black-tiny-bad.pbd simple-command.variables.file DATA-VARS:black.check.tiny.bad
   $ env-desc set black-tiny-bad.pbd simple-command.cwd DATA-VARS:.
 
@@ -83,6 +84,7 @@
     method = simple-command
     name = black.check.tiny
   simple-command:
+    accept-failure = 1
     command = black --check {file}
     cwd = DATA-VARS:.
     variables:
@@ -120,6 +122,7 @@
     method = simple-command
     name = black.check.tiny
   simple-command:
+    accept-failure = 1
     command = black --check {file}
     cwd = DATA-VARS:.
     variables: