From 8d5e68d4441228b0c101940a9b7189938e755130 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 17 Jun 2019 14:52:38 -0700 Subject: [PATCH] Fix for term attrs getting messed up by Fish shell --- bb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bb.c b/bb.c index a4f3d7b..8aed841 100644 --- a/bb.c +++ b/bb.c @@ -187,9 +187,13 @@ void update_term_size(int sig) */ void init_term(void) { + static int first_time = 1; tty_in = fopen("/dev/tty", "r"); tty_out = fopen("/dev/tty", "w"); - tcgetattr(fileno(tty_out), &orig_termios); + if (first_time) { + tcgetattr(fileno(tty_out), &orig_termios); + first_time = 0; + } memcpy(&bb_termios, &orig_termios, sizeof(bb_termios)); cfmakeraw(&bb_termios); bb_termios.c_cc[VMIN] = 0;