GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — lankir/console_windows.go at master · Matbe34/lankir Expand file tree/ Copy pathconsole_windows.goMore file actions 28 lines (25 loc) · 996 Bytes / Copy pathconsole_windows.goFile metadata and controls28 lines (25 loc) · 996 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 //go:build windows package main import ( "os" "syscall" ) // attachParentConsole reattaches stdout/stderr to the parent console on // Windows. The binary is built with -H windowsgui so double-clicking does not // flash a console window, but CLI invocation from cmd/PowerShell still needs // stdout to land somewhere visible. AttachConsole returns 0 if there is no // parent console (e.g. launched from Explorer) — that is the GUI path and we // silently skip rebinding. func attachParentConsole() { const attachParentProcess = ^uintptr(0) // -1, ATTACH_PARENT_PROCESS kernel32 := syscall.NewLazyDLL("kernel32.dll") if r1, _, _ := kernel32.NewProc("AttachConsole").Call(attachParentProcess); r1 == 0 { return } if h, err := syscall.GetStdHandle(syscall.STD_OUTPUT_HANDLE); err == nil && h != 0 { os.Stdout = os.NewFile(uintptr(h), "stdout") } if h, err := syscall.GetStdHandle(syscall.STD_ERROR_HANDLE); err == nil && h != 0 { os.Stderr = os.NewFile(uintptr(h), "stderr") } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |