Files
code-utils/platform/process_windows.go
2026-08-14 07:51:46 +08:00

20 lines
624 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//go:build windows
package platform
import (
"os/exec"
"syscall"
)
// configureHidden 同时设置 HideWindow 和 CREATE_NO_WINDOW避免 git/wsl 查询闪出终端窗口。
func configureHidden(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true, CreationFlags: 0x08000000}
}
// ConfigureDetached 供启动台启动长驻服务:隐藏窗口并放入新进程组,
// 使子进程独立于主程序运行0x00000200 = CREATE_NEW_PROCESS_GROUP
func ConfigureDetached(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true, CreationFlags: 0x08000000 | 0x00000200}
}