Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update main.go to clean up console mode
Something in gum causes console mode to change causing issues (for me Ctrl-C not quitting certain PowerShell commands). We cannot rely on stdin stream as you cannot set console mode on a pipe (causes error, isn't the same thing). Finally found a way to open the stream for console input using magic string `"CONIN$"` thanks to some long google searching. Links in source code. For some reason the console handle changes between start and end of the program so have to reopen the file to get current handle. What the change is doing is opening console at start of mode and saving the mode. It also checks if virtual terminal stuff is available. Then on main exiting it reopens the console and sets the mode to what was saved, including forcing virtual terminal enabled back on. With this change `Ctrl-C` now works after gum has run. This change is in no way cross platform compatible. I will leave that up to someone else to figure out.
- Loading branch information