Commit 19955f0
authored
refactor: simplify launcher script logic for
The `js_binary()` and `js_run_binary()` rules provide a `chdir` option
that you can use to indicate a directory to cd to before the main entry
point is invoked. This turns into a `JS_BINARY__CHDIR` environment
variable that the launcher script looks at to decide where to cd.
The logic has a special case for when `JS_BINARY__CHDIR` begins with
`external/`, in which case we call `resolve_execroot_bin_path` to
canonicalize the path. This special casing seems to be unnecessary, and
`resolve_execroot_bin_path` also contains more logic than we need. I
therefore replaced all this with a one-liner that cds to the correct
absolute path.
The motivation for this is that in another PR I am going to change the
behavior of `resolve_execroot_bin_path` so that it always refers to the
exec platform bin directory, but this is not something we want to affect
`chdir`.
---
### Changes are visible to end-users: no
### Test plan
- Covered by existing test caseschdir (#2813)1 parent 7d28f8e commit 19955f0
2 files changed
Lines changed: 2 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 331 | + | |
335 | 332 | | |
336 | 333 | | |
337 | 334 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments