1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-30 17:18:08 +03:00

ptyfwd: reset colors when we exit the pty forwarding logic

Just in case there was still a color set, make sure to reset things.
This commit is contained in:
Lennart Poettering 2023-12-20 11:58:35 +01:00
parent 760e7a3cb1
commit e7d2b00e0d

View File

@ -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);
}