From: Lennart Poettering Date: Wed, 20 Dec 2023 10:58:35 +0000 (+0100) Subject: ptyfwd: reset colors when we exit the pty forwarding logic X-Git-Tag: v256-rc1~1443^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e7d2b00e0da2ad673678835c9a6b29abd948debc;p=thirdparty%2Fsystemd.git ptyfwd: reset colors when we exit the pty forwarding logic Just in case there was still a color set, make sure to reset things. --- diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index 4950932a967..d01d1b1094f 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -19,6 +19,7 @@ #include "alloc-util.h" #include "errno-util.h" #include "fd-util.h" +#include "io-util.h" #include "log.h" #include "macro.h" #include "ptyfwd.h" @@ -96,6 +97,10 @@ static void pty_forward_disconnect(PTYForward *f) { /* STDIN/STDOUT should not be non-blocking normally, so let's reset it */ (void) fd_nonblock(f->output_fd, false); + + if (colors_enabled()) + (void) loop_write(f->output_fd, ANSI_NORMAL ANSI_ERASE_TO_END_OF_LINE, SIZE_MAX); + if (f->close_output_fd) f->output_fd = safe_close(f->output_fd); }