- r = process_pty(master, &mask, 0, 0);
- if (r < 0) {
- log_error("Failed to process pseudo tty: %s", strerror(-r));
- return r;
- }
+ sd_event_add_signal(event, NULL, SIGINT, NULL, NULL);
+ sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
+
+ r = pty_forward_new(event, master, &forward);
+ if (r < 0)
+ return log_error_errno(r, "Failed to create PTY forwarder: %m");
+
+ r = sd_event_loop(event);
+ if (r < 0)
+ return log_error_errno(r, "Failed to run event loop: %m");
+
+ forward = pty_forward_free(forward);