refactor: hook execution policy #1514
Merged
Add this suggestion to a batch tha
313A
t can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes how the hook programs (mainly scripts) are called. The program used to recognize the
core-hook
andtransparent-hook
as a single executable and pass it as a whole toos.exec
. The behavior is OK on *nix as we can use shebangs, for scripts written in Python or other interpreter-based languages, we can specify the interpreter at the very beginning of it. But it's quite a different story on Windows, onlybat
(cmd) scripts are first-class citizens, we need one of that as an intermediate to invoke what we really want to call. With this change, thecore-hook
andtransparent-hook
will be split by space and collected into an array, the final executable would be the first element in it and all other elements (if any) follow as arguments. This makes pattern likepython core-hook.py
andpwsh transparent-hook.ps1
valid.