run: make PTY forwarder honor vhangup() after service finished

Like we already do in machinectl.
This commit is contained in:
Yu Watanabe
2025-07-29 04:34:01 +09:00
parent dce66b0688
commit b749f77ad0

View File

@@ -1836,6 +1836,14 @@ static void run_context_check_done(RunContext *c) {
log_error_errno(r, "Failed to drain PTY forwarder: %m");
return (void) sd_event_exit(c->event, EXIT_FAILURE);
}
/* Tell the forwarder to exit on the next vhangup(), so that we still flush out what might be queued
* and exit then. */
r = pty_forward_honor_vhangup(c->forward);
if (r < 0) {
log_error_errno(r, "Failed to make PTY forwarder honor vhangup(): %m");
return (void) sd_event_exit(c->event, EXIT_FAILURE);
}
}
static int map_job(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata) {