ptyfwd: always write additional line break on stop

Currently we do that in the user of PTY forwarder, e.g. nspawn.
But, let's do that unconditionally in the PTY forwarder.
This commit is contained in:
Yu Watanabe
2024-12-18 20:26:58 +09:00
parent d517427dff
commit 4a4e7ec0e9
5 changed files with 14 additions and 35 deletions
-6
View File
@@ -1212,7 +1212,6 @@ static int on_machine_removed(sd_bus_message *m, void *userdata, sd_bus_error *r
}
static int process_forward(sd_event *event, PTYForward **forward, int master, PTYForwardFlags flags, const char *name) {
char last_char = 0;
bool machine_died;
int r;
@@ -1239,17 +1238,12 @@ static int process_forward(sd_event *event, PTYForward **forward, int master, PT
if (r < 0)
return log_error_errno(r, "Failed to run event loop: %m");
pty_forward_get_last_char(*forward, &last_char);
machine_died =
(flags & PTY_FORWARD_IGNORE_VHANGUP) &&
pty_forward_get_ignore_vhangup(*forward) == 0;
*forward = pty_forward_free(*forward);
if (last_char != '\n')
fputc('\n', stdout);
if (!arg_quiet) {
if (machine_died)
log_info("Machine %s terminated.", name);