solutions: exit 3 is "interrupted", "not found" moves to 7

The family convention (docs/program-conventions.md) gives 3 to a
command stopped by SIGINT/SIGTERM (owner decision 2026-12-01 to unify).
A cancelled context now exits 3; yetano-solutions also stops on SIGTERM.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-12-01 13:21:10 +01:00
1 parent 4fb9bf9a5a
commit c8a219a84b
3 files changed
+34 -7

No files matched your search

+13 -6
View File
@@ -23,13 +23,17 @@ import (
"yetano.dev/yetano/core/solutions/store"
)
// Exit codes, the same as yet's (yet/internal/cliutil).
// Exit codes, the same as yet's (yet/internal/cliutil). 0-3 are the
// family-wide ones (docs/program-conventions.md in the meta-repo); 3 is
// "interrupted" there, so "not found" is 7 (owner decision 2026-12-01,
// it was 3 up to solutions/v0.1.0).
const (
ExitOK = 0
ExitError = 1
ExitUsage = 2
ExitNotFound = 3
ExitConflict = 4
ExitOK = 0
ExitError = 1
ExitUsage = 2
ExitInterrupted = 3 // stopped by SIGINT/SIGTERM (the context was cancelled)
ExitConflict = 4
ExitNotFound = 7
)
// Env is what the embedding program provides.
@@ -103,6 +107,9 @@ func Run(ctx context.Context, args []string, env Env) int {
code = ee.code
}
switch {
case ctx.Err() != nil:
// whatever failed, it failed because we were told to stop
code = ExitInterrupted
case errors.Is(err, engine.ErrNotFound), errors.Is(err, store.ErrNotFound):
code = ExitNotFound
case errors.Is(err, engine.ErrModified):