返回 DeepSeek-Reasonix
shell_label.go
根目录 / internal / boot / shell_label.go
1 package boot
2
3 import (
4 "path/filepath"
5 "strings"
6
7 "reasonix/internal/sandbox"
8 )
9
10 // resolvedShellLabel preserves the cache-stable kind label when the user did
11 // not configure an explicit path. When a path was configured, it reports the
12 // interpreter actually bound after validation and fallback, so a stale path
13 // can never describe a different executable.
14 func resolvedShellLabel(shell sandbox.Shell, configuredPath, userShellPath string) string {
15 label := shell.Kind.String()
16 if strings.TrimSpace(configuredPath) != "" {
17 if path := strings.TrimSpace(shell.Path); path != "" {
18 label = path
19 }
20 }
21 userShell := filepath.Base(strings.TrimSpace(userShellPath))
22 if userShell != "." && userShell != "" && !strings.ContainsAny(userShell, "\r\n") && userShell != filepath.Base(label) {
23 return label + " (tool subprocess; user login shell: " + userShell + ")"
24 }
25 return label
26 }
27
27 lines GO