matherp
Posts: 14
Joined: Tue May 02, 2017 10:54 am

Not seeing ctrl-Z

Wed Nov 22, 2017 10:14 am

I've got a text based application that uses ncurses in raw mode (all keystrokes go to the application) to do some simple screen handling. The application traps ctrl-Z and does an orderly shutdown when it sees it.

This works perfectly when the application is run in putty over SSH to a Raspbian Lite Pi. It also works perfectly in a console window on a full Raspbian install. However ctrl-Z isn't seenwhen running on the local console on a Raspbian Lite Pi

Any ideas appreciated as to why this is the case and possible solutions.

Thanks

JosAH
Posts: 66
Joined: Sat Nov 12, 2016 2:11 pm
Location: Voorschoten

Re: Not seeing ctrl-Z

Wed Nov 22, 2017 10:42 am

I bet putty itself runs on a MS Windows box which interprets ctrl-Z as an end-of-stream event. On a local terminal (which happens to run on Linux), the same event can be generated by pressing ctrl-D.

kind regards,

Jos

jahboater
Posts: 4595
Joined: Wed Feb 04, 2015 6:38 pm

Re: Not seeing ctrl-Z

Wed Nov 22, 2017 11:01 am

No, ^Z is the suspend key in the console.

https://askubuntu.com/questions/510811/ ... -the-shell

I see that

showkey -a

lets it through.
You might be able to use the ncurses function define_key() to map something else onto ^Z.

^D is EOF
^C aborts the application: SIGINT
^Z suspends it: SIGTSTP

Return to “C/C++”