Commit 533ce08
committed
fix(scripts): SIGPIPE-safe first-line selection in 5 scripts
Five scripts used `| head -1 |` (or `| head -n 1 |`) inside pipelines
under `set -euo pipefail`. When the upstream producer emits multiple
lines, `head` closes its stdin after reading line 1 and SIGPIPE (141)
propagates back, terminating the pipeline and — under pipefail —
aborting the script.
Trigger cases:
- Multi-GPU NVIDIA hosts: nvidia-smi emits N lines -> pre-download.sh
and dream-preflight.sh abort during model selection / GPU probe.
- 2+ downloaded GGUFs: ls -1 *.gguf -> check-offline-models.sh aborts.
- Duplicate keys in .env: grep matches multiple lines -> read_env_value
and read_searxng_secret silently return empty values (|| true
suppresses abort but VAR is empty/truncated).
Replace with `| sed -n '1p' |` -- identical on BSD and GNU sed,
consumes full stdin so upstream producers never receive SIGPIPE.1 parent d5154c3 commit 533ce08
5 files changed
Lines changed: 6 additions & 6 deletions
File tree
- dream-server
- installers/macos
- lib
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
0 commit comments