diff options
| author | divens <divens@users.noreply.github.com> | 2026-02-20 12:55:46 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-20 12:55:46 +0100 |
| commit | 767328df1531815f374dcfd94a956a3ddbe63563 (patch) | |
| tree | bc10dda921839c764b34afb983e1da9334d9f7c8 /zellij-utils | |
| parent | fix: go to welcome screen when opening web root (#4736) (diff) | |
| download | sl0ppij-767328df1531815f374dcfd94a956a3ddbe63563.tar.gz sl0ppij-767328df1531815f374dcfd94a956a3ddbe63563.tar.xz sl0ppij-767328df1531815f374dcfd94a956a3ddbe63563.zip | |
[Windows port PR3] refactor: replace RawFd/AsyncFile, introduce platform-split PTY backend (#4722)
* refactor: replace RawFd with i32 in debug_to_file
Replace the Unix-specific RawFd type with plain i32 in the debug_to_file
infrastructure. This removes the last RawFd usage from the cross-crate
debug logging API, making it platform-independent.
* refactor: cross-platform PTY abstraction with AsyncFd
Replace portable-pty with native openpty and introduce a platform-split
architecture for PTY operations:
- os_input_output_unix.rs: UnixPtyBackend with native openpty, AsyncFd-based
epoll reader (no spawn_blocking per pane), signal handling via nix
- os_input_output_windows.rs: WindowsPtyBackend stubs (unimplemented)
- os_input_output.rs: shared ServerOsApi trait, ServerOsInputOutput composes
PtyBackendImpl, build_command() extracts TerminalAction→RunCommand logic
Key changes:
- AsyncFd<File> replaces both tokio::fs::File (upstream) and spawn_blocking
SyncReadAsyncReader (previous port) for zero-overhead epoll PTY reads
- orig_termios restored: openpty(None, &orig_termios) passes parent's VERASE
- ServerOsApi returns Box<dyn AsyncReader> instead of Box<dyn Read + Send>
- TerminalBytes::new takes Box<dyn AsyncReader> directly
- NullAsyncReader replaces std::io::empty() for held panes
- Platform modules gated with #[cfg(not(windows))] / #[cfg(windows)]
- Removed portable-pty dependency, restored close_fds
- Added tokio "net" feature for AsyncFd
---------
Co-authored-by: divens <divens.dev@gmail.com>
Diffstat (limited to 'zellij-utils')
| -rw-r--r-- | zellij-utils/src/logging.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/zellij-utils/src/logging.rs b/zellij-utils/src/logging.rs index 197b8c9c..087eb845 100644 --- a/zellij-utils/src/logging.rs +++ b/zellij-utils/src/logging.rs @@ -3,7 +3,6 @@ use std::{ fs, io::{self, prelude::*}, - os::unix::io::RawFd, path::{Path, PathBuf}, }; @@ -120,10 +119,10 @@ pub fn atomic_create_dir(dir_name: &Path) -> io::Result<()> { result } -pub fn debug_to_file(message: &[u8], pid: RawFd) -> io::Result<()> { +pub fn debug_to_file(message: &[u8], terminal_id: i32) -> io::Result<()> { let mut path = PathBuf::new(); path.push(&*ZELLIJ_TMP_LOG_DIR); - path.push(format!("zellij-{}.log", pid)); + path.push(format!("zellij-{}.log", terminal_id)); let mut file = fs::OpenOptions::new() .append(true) |
