Commit 2ebdc57
authored
Fixed CLI hanging when terminal is closed (#897)
## What was changed
- Added `SIGHUP` signal handling to gracefully exit when the terminal
disconnects
- Added broken pipe detection in the printer to exit cleanly instead of
hanging when stdout becomes unavailable
## Why?
When a user closes a terminal tab while the CLI is running (or an SSH
session drops), the CLI process could get stuck in an uninterruptible
state. This happened because:
1. The CLI wasn't listening for `SIGHUP` (the signal sent when a
terminal closes)
2. Writes to stdout would block forever when the terminal's file
descriptors were revoked
Now the CLI exits gracefully in both cases instead of requiring a
force-kill.
## Checklist
1. The bug fix discovered during development
2. How was this tested:
- Ran CLI commands and closed the terminal tab mid-execution
- Verified the process exits cleanly instead of hanging in `UE`
(uninterruptible sleep) state
3. Any docs updates needed?
- No1 parent aa925d3 commit 2ebdc57
3 files changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
189 | 192 | | |
190 | 193 | | |
191 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
192 | 208 | | |
193 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
194 | 214 | | |
195 | 215 | | |
196 | 216 | | |
| |||
201 | 221 | | |
202 | 222 | | |
203 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
204 | 228 | | |
205 | 229 | | |
206 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| |||
0 commit comments