|
5 | 5 | import os |
6 | 6 | from typing import Sequence |
7 | 7 |
|
8 | | -from pre_commit.hook import Hook |
9 | 8 | from pre_commit.languages import helpers |
10 | 9 | from pre_commit.prefix import Prefix |
11 | 10 | from pre_commit.util import CalledProcessError |
@@ -123,16 +122,25 @@ def docker_cmd() -> tuple[str, ...]: # pragma: win32 no cover |
123 | 122 |
|
124 | 123 |
|
125 | 124 | def run_hook( |
126 | | - hook: Hook, |
| 125 | + prefix: Prefix, |
| 126 | + entry: str, |
| 127 | + args: Sequence[str], |
127 | 128 | file_args: Sequence[str], |
| 129 | + *, |
| 130 | + require_serial: bool, |
128 | 131 | color: bool, |
129 | 132 | ) -> tuple[int, bytes]: # pragma: win32 no cover |
130 | 133 | # Rebuild the docker image in case it has gone missing, as many people do |
131 | 134 | # automated cleanup of docker images. |
132 | | - build_docker_image(hook.prefix, pull=False) |
| 135 | + build_docker_image(prefix, pull=False) |
133 | 136 |
|
134 | | - entry_exe, *cmd_rest = hook.cmd |
| 137 | + entry_exe, *cmd_rest = helpers.hook_cmd(entry, args) |
135 | 138 |
|
136 | | - entry_tag = ('--entrypoint', entry_exe, docker_tag(hook.prefix)) |
| 139 | + entry_tag = ('--entrypoint', entry_exe, docker_tag(prefix)) |
137 | 140 | cmd = (*docker_cmd(), *entry_tag, *cmd_rest) |
138 | | - return helpers.run_xargs(hook, cmd, file_args, color=color) |
| 141 | + return helpers.run_xargs( |
| 142 | + cmd, |
| 143 | + file_args, |
| 144 | + require_serial=require_serial, |
| 145 | + color=color, |
| 146 | + ) |
0 commit comments