A virtual jailed shell environment for Go apps backed by an io/fs#FS.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(registry): return sentinel error when commands are not found

Signed-off-by: Xe Iaso <me@xeiaso.net>

Xe Iaso 1ea1e5ed e20d26e4

+6 -1
+6 -1
command/registry/registry.go
··· 2 2 3 3 import ( 4 4 "context" 5 + "errors" 5 6 "fmt" 6 7 "path" 7 8 "strings" ··· 10 11 "github.com/go-git/go-billy/v5" 11 12 "mvdan.cc/sh/v3/interp" 12 13 "tangled.org/xeiaso.net/kefka/command" 14 + ) 15 + 16 + var ( 17 + ErrCommandNotFound = errors.New("registry: command not found") 13 18 ) 14 19 15 20 type Impl struct { ··· 99 104 cmd, ok := i.Get(cmdName) 100 105 if !ok { 101 106 fmt.Fprintf(hc.Stderr, "kefka: command not found: %s\n", cmdName) 102 - return interp.ExitStatus(127) 107 + return errors.Join(interp.ExitStatus(127), ErrCommandNotFound) 103 108 } 104 109 105 110 return cmd.Exec(ctx, &command.ExecContext{