Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

registration of signal handlers on all ports #133

Open
GitMensch opened this issue Jun 12, 2022 · 1 comment
Open

registration of signal handlers on all ports #133

GitMensch opened this issue Jun 12, 2022 · 1 comment

Comments

@GitMensch
Copy link
Contributor

see https://invisible-island.net/ncurses/man/curs_initscr.3x.html#h3-Signal-Handlers and https://stackoverflow.com/a/44085449/5027456

According to the search function this is only done on few ports (wincon possibly uses a different approach), and it seems that it may not be only done if the signal is currently SIG_DFL (@Bill-Gray this also applies to PDCursesMod).

Could the behavior be adjusted to be identical (or at least similar) in all ports?
Can you please update the docs to let the users know what to expect?

@Bill-Gray
Copy link
Contributor

Just did a trawl through the code to see how signal handling is currently done. In both PDCurses and PDCursesMod :

  • ozdemo sets up a handler to call endwin() and exit() on SIGINT.
  • In DOS, with DJGPP, raw() causes SIGINT to be ignored; noraw() causes the default action to be taken. With other compilers, the DOS port doesn't do anything about signals.
  • Same for certain configurations on OS/2.
  • X11, as best I can tell, just leaves signal handling at defaults.
  • WinCon uses SetConsoleMode() to "enable processed input" : "Ctrl-C is processed by the system". It doesn't say how (may not involve a signal handler).

In PDCursesMod, DOSVGA copied the DOS approach. The VT and framebuffer ports install a signal handler for SIGINT; in noraw() mode, it attempts to reset the screen... doing some signal-unsafe things in the process, I see (some of which may be unavoidable). Otherwise, a count of the number of Ctrl-Cs hit is incremented.

Still in PDCursesMod, the VT port also handles SIGWINCH (window resized), which every other port can safely ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants