Files
core/solutions/cmd/yetano-solutions/main.go
T
terminarandClaude Opus 5.5 c8a219a84b 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>
2026-12-01 13:21:10 +01:00

56 lines
1.6 KiB
Go

// Command yetano-solutions runs the Solutions Guide commands (CI of the
// catalog, development). The guide is deliberately not part of yet, which
// stays a general tool; the full program with TUI and GUI moves to its
// own repository (docs/knowledge-solutions ADR-0006).
//
// yetano-solutions solution list --catalog assets/solutions
package main
import (
"context"
"os"
"os/signal"
"syscall"
"yetano.dev/yetano/core"
"yetano.dev/yetano/core/paths"
"yetano.dev/yetano/core/solutions/cli"
)
var version = "dev"
func main() {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
// instances, sessions and presets are user data: core/paths' data
// directory (nothing is created until something is saved)
storeDir := os.Getenv("YETANO_SOLUTIONS_HOME")
if storeDir == "" {
if r, err := paths.For(core.Application{Name: "yetano-solutions", Kind: core.CLI}); err == nil {
if d, err := r.DataDir(); err == nil {
storeDir = d
}
}
}
os.Exit(cli.Run(ctx, os.Args[1:], cli.Env{
Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr,
Interactive: isTerminal(os.Stdin) && isTerminal(os.Stdout),
Program: "yetano-solutions",
StoreDir: storeDir,
Version: version,
}))
}
// isTerminal: a character device that is not the null device (/dev/null
// is a character device too, and must never start an interactive wizard).
func isTerminal(f *os.File) bool {
st, err := f.Stat()
if err != nil || st.Mode()&os.ModeCharDevice == 0 {
return false
}
if null, err := os.Stat(os.DevNull); err == nil && os.SameFile(st, null) {
return false
}
return true
}