mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
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:
parent
29cccd0b4a
commit
77f0abb0ba
@ -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
|
||||
|
@ -26,6 +26,8 @@ type Executable struct {
|
||||
Env []string
|
||||
// Args to pass
|
||||
Args []string
|
||||
// Initial working directory
|
||||
Dir string
|
||||
}
|
||||
|
||||
// PID is the running process
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user