2017-12-03 02:52:57 +08:00
|
|
|
package eval
|
|
|
|
|
2017-12-04 04:46:08 +08:00
|
|
|
import "syscall"
|
|
|
|
|
2018-09-29 06:27:03 +08:00
|
|
|
// Nop on Windows.
|
2017-12-03 02:52:57 +08:00
|
|
|
func putSelfInFg() error { return nil }
|
2017-12-04 04:46:08 +08:00
|
|
|
|
2019-04-19 05:15:34 +08:00
|
|
|
// The bitmask for CreationFlags in SysProcAttr to start a process in background.
|
|
|
|
const detachedProcess = 0x00000008
|
2017-12-04 04:46:08 +08:00
|
|
|
|
|
|
|
func makeSysProcAttr(bg bool) *syscall.SysProcAttr {
|
|
|
|
flags := uint32(0)
|
|
|
|
if bg {
|
2019-04-19 05:15:34 +08:00
|
|
|
flags |= detachedProcess
|
2017-12-04 04:46:08 +08:00
|
|
|
}
|
|
|
|
return &syscall.SysProcAttr{CreationFlags: flags}
|
|
|
|
}
|