fix: expand ~ in toolsrv CWD to prevent fork/exec ENOENT
Shell doesn't expand ~ in programmatically-passed arguments, so toolsrv received literal ~/src/ollie as --cwd. Go's os/exec fails with ENOENT on chdir before exec, breaking all tool execution. Expand ~ at two boundaries: - main.go: immediately after flag parsing - proc.go SetCWD(): for runtime cwd changes via 9P
This commit is contained in:
parent
686a560e84
commit
cfc429f5f4
|
|
@ -18,6 +18,7 @@ import (
|
|||
|
||||
"ollie/cmd/toolsrv/internal/exec"
|
||||
"ollie/cmd/toolsrv/internal/registry"
|
||||
"ollie/paths"
|
||||
"ollie/toolsrv"
|
||||
)
|
||||
|
||||
|
|
@ -95,7 +96,7 @@ func (st *State) CWD() string {
|
|||
// SetCWD sets the current working directory.
|
||||
func (st *State) SetCWD(dir string) {
|
||||
st.mu.Lock()
|
||||
st.cwd = dir
|
||||
st.cwd = paths.ExpandHome(dir)
|
||||
st.mu.Unlock()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import (
|
|||
"ollie/env"
|
||||
"ollie/fsedsl"
|
||||
olog "ollie/log"
|
||||
"ollie/paths"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -61,6 +62,9 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Expand ~ in CWD (shell doesn't expand ~ in arguments).
|
||||
*cwd = paths.ExpandHome(*cwd)
|
||||
|
||||
// Set up logger
|
||||
sink := olog.NewSink(os.Stdout, os.Stderr, olog.LevelInfo)
|
||||
defer sink.Flush()
|
||||
|
|
|
|||
Loading…
Reference in New Issue