Repository navigation
Commit 3406515
committed
fix(run): exit with non-zero code on session error in run command
When opencode run encounters a session.error event (e.g., invalid model
specified via --model), the process exits with code 0 instead of 1.
Root cause: loop() was fired and forgotten (.catch only), so after
sdk.session.prompt() returned, execute() exited immediately without
waiting for the event loop. Even when loop() ran and set the `error`
variable, process.exit(1) was never called.
Fix:
- Store the loop() promise instead of .catch()-ing it immediately
- Await loopDone after the prompt/command call
- Call process.exit(1) if error was set during the session
Fixes anomalyco#155581 parent 98c75be commit 3406515
1 file changed
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
| 585 | + | |
589 | 586 | | |
590 | 587 | | |
591 | 588 | | |
| |||
606 | 603 | | |
607 | 604 | | |
608 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
609 | 613 | | |
610 | 614 | | |
611 | 615 | | |
| |||
0 commit comments