wip: process management
This commit is contained in:
9
daemon/daemon.go
Normal file
9
daemon/daemon.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package daemon
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
|
||||
func Start(cmd *cobra.Command, args []string) error {
|
||||
_, _ = cmd, args // prevent warnings for unused arguments
|
||||
|
||||
return nil
|
||||
}
|
||||
23
daemon/process.go
Normal file
23
daemon/process.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
type ProcessConfig interface {
|
||||
Name() string
|
||||
Args() []string
|
||||
Env() map[string]string
|
||||
Dir() string
|
||||
}
|
||||
|
||||
func StartProcess(config ProcessConfig) error {
|
||||
cmd := exec.Command(config.Name(), config.Args()...)
|
||||
for k, v := range config.Env() {
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
cmd.Dir = config.Dir()
|
||||
|
||||
return nil
|
||||
}
|
||||
4
daemon/process_unix.go
Normal file
4
daemon/process_unix.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package daemon
|
||||
|
||||
func DetectDeadChildProcess() {
|
||||
}
|
||||
Reference in New Issue
Block a user