okami.mom/ultraviolet
git clone https://git.nkp.pet/okami.mom/ultraviolet
6ea2266
main
1//go:build windows 2// +build windows 3 4package uv 5 6import ( 7"context" 8"os" 9"os/signal" 10) 11 12func openTTY () (inTty ,outTty * os.File ,err error ) { 13// On Windows, when the input/output is redirected or piped, we need to 14// open the console explicitly. 15// See https://learn.microsoft.com/en-us/windows/console/getstdhandle#remarks 16inTty ,err = os .OpenFile ("CONIN$" ,os .O_RDWR ,0o644 )//nolint:gosec 17if err != nil { 18return nil ,nil ,err //nolint:wrapcheck 19 } 20outTty ,err = os .OpenFile ("CONOUT$" ,os .O_RDWR ,0o644 )//nolint:gosec 21if err != nil { 22return nil ,nil ,err //nolint:wrapcheck 23 } 24return inTty ,outTty ,nil 25} 26 27func suspend () (err error ) { 28// On Windows, suspending the process group is not supported in the same 29// way as Unix-like systems. 30return nil 31} 32 33func notifyWinch (c chan os.Signal ,sigs ... os.Signal ) { 34signal .Notify (c ,sigs ... ) 35} 36 37func notifyWinchContext (ctx context.Context ,sigs ... os.Signal ) (context.Context , context.CancelFunc ) { 38return signal .NotifyContext (ctx ,sigs ... ) 39}