@@ -2068,6 +2068,8 @@ def pre_run_shell_cmd_hook(cmd, *args, **kwargs):
20682068 print("pre-run hook '%s' in %s" % (cmd, work_dir))
20692069 import sys
20702070 sys.stderr.write('pre-run hook done\\ n')
2071+ print("command is allowed to fail: %s" % kwargs.get('fail_on_error', 'NOT AVAILABLE'))
2072+ print("command is hidden: %s" % kwargs.get('hidden', 'NOT AVAILABLE'))
20712073 if cmd != 'false' and not cmd.startswith('echo'):
20722074 cmds = cmd.split(';')
20732075 return '; '.join(cmds[:-1] + ["echo " + cmds[-1].lstrip()])
@@ -2081,6 +2083,8 @@ def post_run_shell_cmd_hook(cmd, *args, **kwargs):
20812083 else:
20822084 msg = "post-run hook '%s'" % cmd
20832085 msg += " (exit code: %s, output: '%s')" % (exit_code, output)
2086+ msg += "\\ ncommand was allowed to fail: %s" % kwargs.get('fail_on_error', 'NOT AVAILABLE')
2087+ msg += "\\ ncommand was hidden: %s" % kwargs.get('hidden', 'NOT AVAILABLE')
20842088 print(msg)
20852089 """ )
20862090 write_file (hooks_file , hooks_file_txt )
@@ -2095,7 +2099,11 @@ def post_run_shell_cmd_hook(cmd, *args, **kwargs):
20952099
20962100 expected_stdout = '\n ' .join ([
20972101 f"pre-run hook 'make' in { cwd } " ,
2102+ "command is allowed to fail: True" ,
2103+ "command is hidden: False" ,
20982104 "post-run hook 'echo make' (exit code: 0, output: 'make\n ')" ,
2105+ "command was allowed to fail: True" ,
2106+ "command was hidden: False" ,
20992107 '' ,
21002108 ])
21012109 self .assertEqual (stdout , expected_stdout )
@@ -2109,6 +2117,8 @@ def post_run_shell_cmd_hook(cmd, *args, **kwargs):
21092117
21102118 expected_stdout = '\n ' .join ([
21112119 "pre-run hook 'make' in %s" % cwd ,
2120+ "command is allowed to fail: True" ,
2121+ "command is hidden: False" ,
21122122 ' running shell command "echo make"' ,
21132123 ' (in %s)' % cwd ,
21142124 '' ,
@@ -2135,8 +2145,14 @@ def post_run_shell_cmd_hook(cmd, *args, **kwargs):
21352145 pass
21362146 stdout = self .get_stdout ()
21372147
2138- expected_last_line = "\n post-run hook 'false' (exit code: 1, output: '')\n "
2139- self .assertTrue (stdout .endswith (expected_last_line ), f"Stdout should end with '{ expected_last_line } ': { stdout } " )
2148+ expected_end = '\n ' .join ([
2149+ '' ,
2150+ "post-run hook 'false' (exit code: 1, output: '')" ,
2151+ "command was allowed to fail: True" ,
2152+ "command was hidden: False" ,
2153+ '' ,
2154+ ])
2155+ self .assertTrue (stdout .endswith (expected_end ), f"Stdout should end with '{ expected_end } ': { stdout } " )
21402156
21412157 def test_run_shell_cmd_delete_cwd (self ):
21422158 """
0 commit comments