Commit 32d7a24
authored
fix: use "command -v" to find interpreter in $PATH (#3150)
In some environments, `which` doesn't work correctly under Bazel, while
`command -v` does.
I think the difference is that `command` is a shell builtin (and POSIX
compliant), whereas `which` is not:
```
$ sh -c 'builtin command -v python3'
/usr/bin/python3
$ sh -c 'builtin which python3'
sh: line 1: builtin: which: not a shell builtin
```
While `command -v` performs fewer checks under the hood, it is more
portable.1 parent e3655c2 commit 32d7a24
File tree
2 files changed
+7
-7
lines changed- python/private
2 files changed
+7
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 20 | + | |
23 | 21 | | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | | - | |
| 25 | + | |
28 | 26 | | |
29 | | - | |
| 27 | + | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
| |||
37 | 35 | | |
38 | 36 | | |
39 | 37 | | |
40 | | - | |
| 38 | + | |
41 | 39 | | |
42 | | - | |
| 40 | + | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| |||
0 commit comments