Enabling micro run for subfolders (#1510)

* Enabling micro run for subfolders

* Use source instead of os.Args[2]

* Works now

* PR comments

* WorkDir -> Dir
This commit is contained in:
Janos Dobronszki 2020-04-09 16:44:39 +02:00 committed by GitHub
parent 29cccd0b4a
commit 77f0abb0ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -26,6 +26,8 @@ type Executable struct {
Env []string
// Args to pass
Args []string
// Initial working directory
Dir string
}
// PID is the running process

View File

@ -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,