Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_shell_cmd hooks should be applied earlier #4490

Open
Micket opened this issue Mar 29, 2024 · 0 comments
Open

run_shell_cmd hooks should be applied earlier #4490

Micket opened this issue Mar 29, 2024 · 0 comments
Milestone

Comments

@Micket
Copy link
Contributor

Micket commented Mar 29, 2024

The hooks for run_shell_cmd

if with_hooks:
hooks = load_hooks(build_option('hooks'))
hook_res = run_hook(RUN_SHELL_CMD, hooks, pre_step_hook=True, args=[cmd], kwargs={'work_dir': work_dir})
if hook_res:
cmd, old_cmd = hook_res, cmd
cmd_str = to_cmd_str(cmd)
_log.info("Command to run was changed by pre-%s hook: '%s' (was: '%s')", RUN_SHELL_CMD, cmd, old_cmd)

are applied just before we run the subprocess, but after all of logging, dry-run etc. cmd_str (before hooks) is used in a bunch of places.

I would argue it should be done as early as possible, since it would reflect the true command being run.

@Micket Micket added this to the 5.0 milestone Mar 29, 2024
@Micket Micket changed the title run_shell_cmd hooks shoudl be applied earlier run_shell_cmd hooks should be applied earlier Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

1 participant