diff --git a/runtime/local/process/os/os.go b/runtime/local/process/os/os.go index f1825e97a7..a35d0b7972 100644 --- a/runtime/local/process/os/os.go +++ b/runtime/local/process/os/os.go @@ -15,13 +15,17 @@ import ( func (p *Process) Exec(exe *process.Executable) error { cmd := exec.Command(exe.Package.Path) + cmd.Dir = exe.Dir return cmd.Run() } func (p *Process) Fork(exe *process.Executable) (*process.PID, error) { // create command cmd := exec.Command(exe.Package.Path, exe.Args...) + + cmd.Dir = exe.Dir // set env vars + cmd.Env = append(cmd.Env, os.Environ()...) cmd.Env = append(cmd.Env, exe.Env...) // create process group diff --git a/runtime/local/process/process.go b/runtime/local/process/process.go index 4449d294ea..ffeae63eb4 100644 --- a/runtime/local/process/process.go +++ b/runtime/local/process/process.go @@ -26,6 +26,8 @@ type Executable struct { Env []string // Args to pass Args []string + // Initial working directory + Dir string } // PID is the running process diff --git a/runtime/service.go b/runtime/service.go index 9c6bdc1668..eb6c4154ca 100644 --- a/runtime/service.go +++ b/runtime/service.go @@ -55,6 +55,7 @@ func newService(s *Service, c CreateOptions) *service { }, Env: c.Env, Args: args, + Dir: s.Source, }, closed: make(chan bool), output: c.Output,