Commit 6f92f56
committed
fix(dev): prevent orphaned servers and handle empty prompt
Fixes found during bugbash of auto-start feature:
- Register process.on('exit') handler to kill auto-started server,
ensuring cleanup even when invoke helpers call process.exit(1)
- Initialize resolveServerExit with safe default to prevent
potential undefined call if Promise executor changes
- Add unref() to SIGKILL timer in DevServer.kill() so Node.js
exits promptly instead of hanging 2 seconds
- Use !== undefined check for prompt so empty string "" enters
invoke path instead of falling through to interactive TUI
Constraint: process.on('exit') handlers are synchronous; cannot await server shutdown
Rejected: Modify invoke helpers to throw instead of process.exit | too many callers to change
Confidence: high
Scope-risk: narrow
Not-tested: rapid consecutive invocations (port TIME_WAIT race)1 parent 814a1d0 commit 6f92f56
2 files changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
| 214 | + | |
| 215 | + | |
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
| |||
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
235 | 240 | | |
236 | 241 | | |
237 | 242 | | |
| |||
240 | 245 | | |
241 | 246 | | |
242 | 247 | | |
243 | | - | |
244 | 248 | | |
245 | 249 | | |
246 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
| |||
0 commit comments