T1.2: Create src/platform/winproc; move configureHiddenWindow
Extract the hidden-window logic out of src/core runner and autostart files into a new platform/winproc package with per-OS build-tag files. All call sites updated to use winproc.ConfigureHiddenWindow. Builds clean on both Windows and Linux; all tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
//go:build !windows
|
||||
|
||||
package winproc
|
||||
|
||||
import "os/exec"
|
||||
|
||||
// ConfigureHiddenWindow is a no-op on non-Windows platforms: launching sh -c
|
||||
// from a desktop process does not create a new console window in the same way
|
||||
// Windows does.
|
||||
func ConfigureHiddenWindow(command *exec.Cmd) {}
|
||||
@@ -0,0 +1,18 @@
|
||||
package winproc
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// ConfigureHiddenWindow suppresses the console window that Windows would
|
||||
// otherwise flash when running a child process from a GUI application.
|
||||
// CREATE_NO_WINDOW keeps cmd.exe and simple console tools quiet while
|
||||
// stdout/stderr are still captured through pipes.
|
||||
func ConfigureHiddenWindow(command *exec.Cmd) {
|
||||
if command.SysProcAttr == nil {
|
||||
command.SysProcAttr = &syscall.SysProcAttr{}
|
||||
}
|
||||
command.SysProcAttr.CreationFlags |= 0x08000000
|
||||
command.SysProcAttr.HideWindow = true
|
||||
}
|
||||
Reference in New Issue
Block a user