diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2023-02-22 12:40:30 -0500 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2023-02-22 12:40:30 -0500 |
commit | 65515ba923039b2a4c84e34822fd7c9e4911786d (patch) | |
tree | 585072a1fe54d1d0e2b8ab18bef1e4c622dad028 /cmd/atlas | |
parent | 6c29477f03a7432bf0eb5116050be405e0b2a996 (diff) | |
download | Atlas-65515ba923039b2a4c84e34822fd7c9e4911786d.tar.gz Atlas-65515ba923039b2a4c84e34822fd7c9e4911786d.zip |
cmd/atlas: Disable console quick-edit on Windows
This prevents selecting text from freezing the server.
Diffstat (limited to 'cmd/atlas')
-rw-r--r-- | cmd/atlas/main_windows.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/atlas/main_windows.go b/cmd/atlas/main_windows.go new file mode 100644 index 0000000..a6a1912 --- /dev/null +++ b/cmd/atlas/main_windows.go @@ -0,0 +1,20 @@ +//go:build windows + +package main + +import ( + "os" + + "golang.org/x/sys/windows" +) + +func init() { + con := windows.Handle(os.Stdin.Fd()) + + var mode uint32 + if err := windows.GetConsoleMode(con, &mode); err == nil { + mode |= windows.ENABLE_EXTENDED_FLAGS + mode &^= windows.ENABLE_QUICK_EDIT_MODE + _ = windows.SetConsoleMode(con, mode) + } +} |