if (bytes_read < 0)
return bytes_read;
+ DEBUG(pty->ctx, "Read %zd byte(s) from input callback\n", bytes_read);
+
// Otherwise read from the file descriptor
} else if (fd >= 0) {
bytes_read = read(fd, stdio->buffer + stdio->buffered, sizeof(stdio->buffer) - stdio->buffered);
// Abort on errors
if (bytes_read < 0)
return -errno;
+
+ DEBUG(pty->ctx, "Read %zd byte(s) from fd=%d\n", bytes_read, fd);
}
// Successful read
if (bytes_written < 0)
return bytes_written;
+ DEBUG(pty->ctx, "Sent %zd byte(s) to output callback\n", bytes_written);
+
// Otherwise we write to the file descriptor
} else if (fd >= 0) {
bytes_written = write(fd, stdio->buffer, stdio->buffered);
// Abort on error
if (bytes_written < 0)
return -errno;
+
+ DEBUG(pty->ctx, "Wrote %zd byte(s) to fd=%d\n", bytes_written, fd);
}
// Successful write
((pty->master.io & PAKFIRE_PTY_READY_TO_READ) && !pakfire_pty_buffer_is_full(pty, &pty->stdout)) ||
((pty->stdout.io & PAKFIRE_PTY_READY_TO_WRITE) && pakfire_pty_buffer_has_data(pty, &pty->stdout))
) {
- // DEBUG(pty->ctx, "PTY forward stdin=%x %zu, stdout=%x %zu, %x\n",
- // pty->stdin.io, pty->stdin.buffered, pty->stdout.io, pty->stdout.buffered, pty->master.io);
+ // DEBUG(pty->ctx, "PTY forward stdin=%x %zu, stdout=%x %zu, %x, draining=%d, drained=%d\n",
+ // pty->stdin.io, pty->stdin.buffered, pty->stdout.io, pty->stdout.buffered, pty->master.io,
+ // pty->state == PAKFIRE_PTY_STATE_DRAINING, pakfire_pty_drained(pty));
// Read from standard input
if (pty->stdin.io & PAKFIRE_PTY_READY_TO_READ) {