Commit 85ebc88
endolinbot
chore(shellcheck): adopt die idiom for early termination in touched .sh files
Address kriskowal's CHANGES_REQUESTED review on #401: replace bare
`|| exit` after `cd` with `|| die "<context>"` so early-termination
sites emit a context line to stderr and exit non-zero, as with Perl's
`die`. Each touched script defines its own helper near the top:
die() { printf '%s\n' "$*" >&2; exit 1; }
`printf` (not `echo -e`) avoids portability traps under /bin/sh.
Sites upgraded across the .sh files this PR touched:
- packages/nat/scripts/npm-audit-fix.sh: `cd nat`, `cd integration-test`
- scripts/npm-audit-fix.sh: `cd ???`
- scripts/posttypedoc.sh: `cd docs`, `cd api-docs`
scripts/check-packages.sh's terminal `exit "$EXIT"` and scripts/
shellcheck.sh's `exit 0` skip-when-empty are intentional orderly
exits, not the early-termination pattern the review objects to.
Left as-is.
The "throughout" scope is the .sh files this PR touched (the seven
plus the new scripts/shellcheck.sh); broader cross-tree adoption is
left to a separate dispatch if the maintainer wants it.1 parent fe73a47 commit 85ebc88
3 files changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | | - | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | | - | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | | - | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | | - | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | | - | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
0 commit comments