fix: set bg proc attr in build tagged file

extended-job-api
TorchedSammy 2022-05-21 06:03:53 -04:00
parent 1522749397
commit 4bc94ce916
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
4 changed files with 11 additions and 12 deletions

12
exec.go
View File

@ -359,18 +359,6 @@ func execHandle(bg bool) interp.ExecHandlerFunc {
var j *job
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.setHandle(&cmd)
err = j.start()

View File

@ -4,8 +4,13 @@ package main
import (
"os"
"syscall"
)
var bgProcAttr *syscall.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
func findExecutable(path string, inPath, dirs bool) error {
f, err := os.Stat(path)
if err != nil {

View File

@ -5,8 +5,13 @@ package main
import (
"path/filepath"
"os"
"syscall"
)
var bgProcAttr *syscall.SysProcAttr = &syscall.SysProcAttr{
CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP,
}
func findExecutable(path string, inPath, dirs bool) error {
nameExt := filepath.Ext(path)
pathExts := filepath.SplitList(os.Getenv("PATHEXT"))

1
job.go
View File

@ -43,6 +43,7 @@ func (j *job) start() error {
}
j.setHandle(&cmd)
}
j.handle.SysProcAttr = bgProcAttr
if !j.once {
j.once = true