mirror of
https://github.com/rancher/os.git
synced 2025-06-27 23:36:49 +00:00
setsid in respawn
This commit is contained in:
parent
c0cee91cd1
commit
b0046e8e08
@ -25,7 +25,6 @@ func Main() {
|
|||||||
app.Action = run
|
app.Action = run
|
||||||
|
|
||||||
app.Run(os.Args)
|
app.Run(os.Args)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func run(c *cli.Context) {
|
func run(c *cli.Context) {
|
||||||
@ -49,6 +48,9 @@ func run(c *cli.Context) {
|
|||||||
var wait sync.WaitGroup
|
var wait sync.WaitGroup
|
||||||
|
|
||||||
for _, line := range strings.Split(string(input), "\n") {
|
for _, line := range strings.Split(string(input), "\n") {
|
||||||
|
if strings.TrimSpace(line) == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
wait.Add(1)
|
wait.Add(1)
|
||||||
go execute(line, wait)
|
go execute(line, wait)
|
||||||
}
|
}
|
||||||
@ -63,7 +65,7 @@ func execute(line string, wait sync.WaitGroup) {
|
|||||||
for {
|
for {
|
||||||
args := strings.Split(line, " ")
|
args := strings.Split(line, " ")
|
||||||
|
|
||||||
cmd := exec.Command(args[0], args[1:]...)
|
cmd := exec.Command("setsid", args...)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
cmd.Stdin = os.Stdin
|
cmd.Stdin = os.Stdin
|
||||||
|
Loading…
Reference in New Issue
Block a user