mirror of https://github.com/Hilbis/Hilbish
fix: use setpgid on cmd procattr for background jobs
parent
055132aa10
commit
4a5e4957d7
12
exec.go
12
exec.go
|
@ -359,6 +359,18 @@ func execHandle(bg bool) interp.ExecHandlerFunc {
|
||||||
|
|
||||||
var j *job
|
var j *job
|
||||||
if bg {
|
if bg {
|
||||||
|
var procAttr *syscall.SysProcAttr
|
||||||
|
if runtime.GOOS != "windows" {
|
||||||
|
procAttr = &syscall.SysProcAttr{
|
||||||
|
CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
procAttr = &syscall.SysProcAttr{
|
||||||
|
Setpgid: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmd.SysProcAttr = procAttr
|
||||||
|
|
||||||
j = jobs.getLatest()
|
j = jobs.getLatest()
|
||||||
j.setHandle(&cmd)
|
j.setHandle(&cmd)
|
||||||
err = j.start()
|
err = j.start()
|
||||||
|
|
Loading…
Reference in New Issue