zoom
Posts: 8
Joined: Thu Jun 01, 2017 4:18 am

Control-C, Control-Z don't terminate program in Jessie

Thu Jun 01, 2017 4:31 am

I must have my keyboard set up wrong. I don't get the usual termination actions from within Terminal (or even from the CLI which the pi now boots to) when I hit Control-C or Control-Z. I've tried resetting the keyboard from within the gui (Pi > Preferences > Mouse and Keyboard settings > Keyboard > Keyboard Layout. When I choose "English (US)" and OK all the way out, this choice does not persist and when I replay the procedure to choose the keyboard layout, it comes up set to United States with a "Spanish (Latin American) setting highlighted. Since the gui (which I've started from both a user and a root session, no difference) method appears to be ineffective, what would be the CLI method for getting the right keyboard layout and the normal Control-C, Control-Z actions? TIA

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Control-C, Control-Z don't terminate program in Jessie

Thu Jun 01, 2017 10:28 am

In my 13 years of Linux usage I've never experienced that keyboard layout has any effect on CTRL-Z or CTRL-C.

But not all programs behave the same way, software can handle the signal they get from CTRL-C and choose to ignore it.
In those cases CTRL-Z usually works for me because that is picked up by the shell ( I believe ) and the program is put in the background. ( and then I can kill the process manually )

It could be relevant to hear which programs you try to break the execution of.

zoom
Posts: 8
Joined: Thu Jun 01, 2017 4:18 am

Re: Control-C, Control-Z don't terminate program in Jessie

Thu Jun 01, 2017 11:21 am

Initially just lua and python scripts. I don't think it's a characteristic of the programs involved - other distros almost always deliver the SIGINT that breaks one out of a program, with Control-C. It may not be keyboard layout but, I'm used to this being default behavior.

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Control-C, Control-Z don't terminate program in Jessie

Thu Jun 01, 2017 11:52 am

Python is definitly one of the programs that have a special handler for SIGINT. Just start "python" in interactive mode and press CTRL-C to test.
CTRL-C is just another Exception i Python that can be easily caught ( intentionally or not ) by the script.

If you can run the "sleep 60" command in a shell and break it with CTRL-C (or suspend it with CTRL-Z ) then your keyboard works as intended.

zoom
Posts: 8
Joined: Thu Jun 01, 2017 4:18 am

Re: Control-C, Control-Z don't terminate program in Jessie

Thu Jun 01, 2017 11:55 am

Problem solved - apparently this Dell keyboard is non-standard or malfunctioning. I simply hooked up another keyboard and experienced normal behavior with Control-C and Control-Z.

klricks
Posts: 7154
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Control-C, Control-Z don't terminate program in Jessie

Thu Jun 01, 2017 12:16 pm

zoom wrote:........... When I choose "English (US)" and OK all the way out, this choice does not persist and when I replay the procedure to choose the keyboard layout, it comes up set to United States with a "Spanish (Latin American) setting highlighted.........
Even though the Spanish keyboard gets highlighted when you return to the setup, it is not actually changed to that unless you then press OK.

Also on some keyboards using the left or right CTRL key does not do the same thing.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

Return to “General discussion”