환경변수를 expand할 수 있음

This commit is contained in:
2023-11-29 18:46:10 +09:00
parent 6eaa856688
commit 023a2a5194
4 changed files with 12 additions and 5 deletions

View File

@ -153,7 +153,14 @@ func prepareProcessLaunch(storageRoot string, req *shared.StartProcessRequest) *
os.Chmod(path.Join(verpath, exefile), 0777)
exef, _ := os.Executable()
cmd := exec.Command(path.Join(path.Dir(exef), verpath, exefile), req.Args[1:]...)
expanded := make([]string, len(req.Args))
for i, arg := range req.Args {
expanded[i] = os.ExpandEnv(arg)
}
exename := path.Join(path.Dir(exef), verpath, exefile)
cmd := exec.Command(os.ExpandEnv(exename), expanded[1:]...)
cmd.Dir = verpath
stdin, _ := cmd.StdinPipe()