Skip to content

Commit

Permalink
make escape sequence to exit tty optional
Browse files Browse the repository at this point in the history
We want to reuse lxc_console_cb_tty_stdin() in lxc_attach.c.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
  • Loading branch information
Christian Brauner committed Feb 21, 2016
1 parent 7e8aa95 commit 014d5e1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/lxc/console.c
Expand Up @@ -641,16 +641,19 @@ static int lxc_console_cb_tty_stdin(int fd, uint32_t events, void *cbdata,
return 1;
}

/* we want to exit the console with Ctrl+a q */
if (c == ts->escape && !ts->saw_escape) {
ts->saw_escape = 1;
return 0;
}
if (ts->escape != -1) {
/* we want to exit the console with Ctrl+a q */
if (c == ts->escape && !ts->saw_escape) {
ts->saw_escape = 1;
return 0;
}

if (c == 'q' && ts->saw_escape)
return 1;
if (c == 'q' && ts->saw_escape)
return 1;

ts->saw_escape = 0;
}

ts->saw_escape = 0;
if (write(ts->masterfd, &c, 1) < 0) {
SYSERROR("failed to write");
return 1;
Expand Down

0 comments on commit 014d5e1

Please sign in to comment.