(proc: ChildProcess)
| 302 | }; |
| 303 | } |
| 304 | async function waitForProcessExit(proc: ChildProcess): Promise<number> { |
| 305 | // Callers often consume stdout before awaiting the process. Tiny git helpers |
| 306 | // can close in that window, so make the helper safe even when subscribed late. |
| 307 | if (proc.exitCode !== null) { |
| 308 | return proc.exitCode; |
| 309 | } |
| 310 | if (proc.signalCode !== null) { |
| 311 | return 1; |
| 312 | } |
| 313 | |
| 314 | return new Promise((resolve, reject) => { |
| 315 | proc.on("close", (code) => resolve(code ?? 1)); |
| 316 | proc.on("error", (err) => reject(err)); |
| 317 | }); |
| 318 | } |
| 319 | |
| 320 | /** Truncate SSH stderr for error logging (prefer the first transport-related line, max 200 chars). */ |
| 321 | function truncateSSHError(stderr: string): string { |
no test coverage detected