]> git.ipfire.org Git - pakfire.git/commitdiff
PTY: Automatically connect stdout/stderr in some cases
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 16 Feb 2025 14:54:02 +0000 (14:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 16 Feb 2025 14:54:02 +0000 (14:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/pty.c

index f7ddd854cc19717b7fc2fbe85f2d71cc735ca259..a343255ce5befde4e0e9751e7b0a4f1719b9129f 100644 (file)
@@ -1280,6 +1280,9 @@ int pakfire_pty_create(struct pakfire_pty** pty, struct pakfire_ctx* ctx,
        // Store the flags
        p->flags = flags;
 
+       if (pakfire_pty_has_flag(p, PAKFIRE_PTY_CAPTURE_OUTPUT))
+               p->flags |= PAKFIRE_PTY_CONNECT_STDOUT | PAKFIRE_PTY_CONNECT_STDERR;
+
        // Initialize the master file descriptor
        p->master.fd = -EBADF;
 
@@ -1547,6 +1550,9 @@ void pakfire_pty_set_stdout_callback(struct pakfire_pty* pty,
 
        // We are now ready to write
        pty->stdout.io |= PAKFIRE_PTY_READY_TO_WRITE|PAKFIRE_PTY_MAP_CRNL;
+
+       // Actually connect standard output and error
+       pty->flags |= PAKFIRE_PTY_CONNECT_STDOUT | PAKFIRE_PTY_CONNECT_STDERR;
 }
 
 ssize_t pakfire_pty_send_buffer(struct pakfire_ctx* ctx,