Skip to content

Commit

Permalink
Enable ^Z (SUSP) support
Browse files Browse the repository at this point in the history
Allows the current process to be backgrounded and then resumed.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
  • Loading branch information
msteveb committed Jan 1, 2018
1 parent e795d44 commit 29aedbd
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions linenoise.c
Expand Up @@ -129,6 +129,7 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>

Expand Down Expand Up @@ -1230,6 +1231,16 @@ static int linenoiseEdit(struct current *current) {
case ctrl('C'): /* ctrl-c */
errno = EAGAIN;
return -1;
case ctrl('Z'): /* ctrl-z */
#ifdef SIGTSTP
/* send ourselves SIGSUSP */
disableRawMode(current);
raise(SIGTSTP);
/* and resume */
enableRawMode(current);
refreshLine(current->prompt, current);
#endif
continue;
case 127: /* backspace */
case ctrl('H'):
if (remove_char(current, current->pos - 1) == 1) {
Expand Down

0 comments on commit 29aedbd

Please sign in to comment.