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

Suspend (Ctrl-Z) and Quit (Ctrl-\) not handled #20

Closed
birkenfeld opened this issue Feb 6, 2016 · 5 comments
Closed

Suspend (Ctrl-Z) and Quit (Ctrl-\) not handled #20

birkenfeld opened this issue Feb 6, 2016 · 5 comments

Comments

@birkenfeld
Copy link
Contributor

Since rustyline removes the ISIG flag from the terminal, pressing Ctrl-Z or Ctrl-\ will insert a character instead of suspending/quitting the process. Especially suspend is quite essential for any CLI program.

Please consider using the default signal handling, or implementing some kind of handler for Ctrl-Z and Ctrl-\ that generates the signals.

@kkawakam
Copy link
Owner

kkawakam commented Feb 7, 2016

I don't think I can use default signal handling. I will probably implement some type of handler for C-z and C-\ so that we can reset the terminal attributes before generating the proper signals.

I am looking at GNU readline's doc and it seems like readline takes this approach.

@birkenfeld
Copy link
Contributor Author

As far as I could see, there is a #define in libreadline called HANDLE_SIGNALS that determines if ISIG is cleared or not. Not sure what the default is though.

@kkawakam
Copy link
Owner

kkawakam commented Feb 7, 2016

It looks like that is defined by default in http://git.savannah.gnu.org/cgit/readline.git/tree/rlconf.h so I'd be surprised if the compiled library version you are using does not have that defined.

Looking at https://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC44 and http://git.savannah.gnu.org/cgit/readline.git/tree/signals.c I do see that the readline's signal handler cleans up the terminal state and and then re-raises the signal.

@gwenn
Copy link
Collaborator

gwenn commented Apr 6, 2016

I try to handle Ctrl-Z in this PR.
But Ctrl-Z must be typed twice and can't find why...
An explanation may be found here ?

gwenn added a commit to gwenn/rustyline that referenced this issue Nov 12, 2016
gwenn added a commit to gwenn/rustyline that referenced this issue Nov 27, 2016
@gwenn
Copy link
Collaborator

gwenn commented Aug 26, 2018

2.0 released

@gwenn gwenn closed this as completed Aug 26, 2018
gwenn pushed a commit to gwenn/rustyline that referenced this issue Nov 30, 2018
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

3 participants