tty: do not print line feed after ^C, et al.
This commit is contained in:
parent
dd33c722c5
commit
88a1df00a6
@ -874,7 +874,10 @@ static char * _strsignal(int sig) {
|
||||
static void handle_status(int ret_code) {
|
||||
if (WIFSIGNALED(ret_code)) {
|
||||
int sig = WTERMSIG(ret_code);
|
||||
if (sig == SIGINT || sig == SIGPIPE) return;
|
||||
if (sig == SIGINT || sig == SIGPIPE) {
|
||||
fprintf(stderr, "\n");
|
||||
return;
|
||||
}
|
||||
char * str = _strsignal(sig);
|
||||
if (shell_interactive == 1) {
|
||||
fprintf(stderr, "%s\n", str);
|
||||
@ -890,6 +893,7 @@ int wait_for_child(int pgid, char * name, int retpid) {
|
||||
int ret_code = 0;
|
||||
int ret_code_real = 0;
|
||||
int e;
|
||||
int _stopped = 0;
|
||||
|
||||
do {
|
||||
outpid = waitpid(waitee, &ret_code, WSTOPPED);
|
||||
@ -902,7 +906,7 @@ int wait_for_child(int pgid, char * name, int retpid) {
|
||||
if (name) {
|
||||
hashmap_set(job_hash, (void*)(intptr_t)pgid, strdup(name));
|
||||
}
|
||||
fprintf(stderr, "[%d] Stopped\t\t%s\n", pgid, (char*)hashmap_get(job_hash, (void*)(intptr_t)pgid));
|
||||
_stopped = 1;
|
||||
break;
|
||||
} else {
|
||||
suspended_pgid = 0;
|
||||
@ -913,6 +917,7 @@ int wait_for_child(int pgid, char * name, int retpid) {
|
||||
} while (outpid != -1 || (outpid == -1 && e != ECHILD));
|
||||
reset_pgrp();
|
||||
handle_status(ret_code_real);
|
||||
if (_stopped && shell_interactive) fprintf(stderr, "[%d] Stopped\t\t%s\n", pgid, (char*)hashmap_get(job_hash, (void*)(intptr_t)pgid));
|
||||
return WEXITSTATUS(ret_code_real);
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,6 @@ void tty_input_process(pty_t * pty, uint8_t c) {
|
||||
if (pty->tios.c_lflag & ECHO) {
|
||||
output_process(pty, '^');
|
||||
output_process(pty, ('@' + c) % 128);
|
||||
output_process(pty, '\n');
|
||||
}
|
||||
clear_input_buffer(pty);
|
||||
if (pty->fg_proc) {
|
||||
|
Loading…
Reference in New Issue
Block a user