moar icon indicating copy to clipboard operation
moar copied to clipboard

Fix `select` based shutdown on Windows

Open walles opened this issue 1 year ago • 0 comments

Using moar? Have a Go setup on Windows? Please help!

On Windows, in the johan/select-shutdown branch, this code triggers immediately on startup and moar shuts down:

https://github.com/walles/moar/blob/johan/select-shutdown/twin/screen.go#L385-L387:

	if rFDSet.IsSet(screen.shutdownPipeReader.Fd()) {
		return 0, errShutdownInitiated
	}

With the shutdown code on master...

  • ... when exiting on v to edit...
  • ... using a terminal based editor...
  • ... then moar will steal the first byte(s) of the editor's input before terminating.

The correct solution is to use select for shutdown. The linked branch works fine on macOS but fails on Windows.

Kindly help figuring this out!

walles avatar Jun 30 '24 11:06 walles