| 19 | |
| 20 | |
| 21 | def run_hook( |
| 22 | prefix: Prefix, |
| 23 | entry: str, |
| 24 | args: Sequence[str], |
| 25 | file_args: Sequence[str], |
| 26 | *, |
| 27 | is_local: bool, |
| 28 | require_serial: bool, |
| 29 | color: bool, |
| 30 | ) -> tuple[int, bytes]: |
| 31 | # `entry` is a (hook-repo relative) file followed by (optional) args, e.g. |
| 32 | # `bin/id.jl` or `bin/hook.jl --arg1 --arg2` so we |
| 33 | # 1) shell parse it and join with args with hook_cmd |
| 34 | # 2) prepend the hooks prefix path to the first argument (the file), unless |
| 35 | # it is a local script |
| 36 | # 3) prepend `julia` as the interpreter |
| 37 | |
| 38 | cmd = lang_base.hook_cmd(entry, args) |
| 39 | script = cmd[0] if is_local else prefix.path(cmd[0]) |
| 40 | cmd = ('julia', '--startup-file=no', script, *cmd[1:]) |
| 41 | return lang_base.run_xargs( |
| 42 | cmd, |
| 43 | file_args, |
| 44 | require_serial=require_serial, |
| 45 | color=color, |
| 46 | ) |
| 47 | |
| 48 | |
| 49 | def get_env_patch(target_dir: str, version: str) -> PatchesT: |