A modern terminal with a built-in multiplexer: close it and your sessions keep running. Run shells and tons of AI agents across your machines, then pick them up from desktop, browser, TUI and more. Written in Rust with no UI framework: interface drawn straight on the GPU. No Electron, GPUI or webview.
Rust agentagent-orchestrationaiai-agentsclaude-codecodexcoding-agentlinuxmacosmultiplayermultiplexerrustterminalterminal-emulatorterminal-multiplexertmuxtuiweztermwindows
fix(handoff): make adopted ptys blocking
RoversX3800e71667aa
diff --git a/wezterm-mux-server-impl/src/handoff.rs b/wezterm-mux-server-impl/src/handoff.rsindex 8c173781..3dac5190 100644--- a/wezterm-mux-server-impl/src/handoff.rs+++ b/wezterm-mux-server-impl/src/handoff.rs@@ -842,8 +842,19 @@ fn install(Ok(())}+/// A session imported from another program keeps that program's O_NONBLOCK+/// until the next handoff. Ordinary panes read and write blocking.+fn ensure_blocking(fd: &OwnedFd) -> anyhow::Result<()> {+ let flags = rustix::fs::fcntl_getfl(fd)?;+ if flags.contains(rustix::fs::OFlags::NONBLOCK) {+ rustix::fs::fcntl_setfl(fd, flags.difference(rustix::fs::OFlags::NONBLOCK))?;+ }+ Ok(())+}+fn adopt_pane(item: Received, domain_id: DomainId) -> anyhow::Result<Arc<dyn Pane>> {let Received { pane, fd, snapshot, mut graphics } = item;+ ensure_blocking(&fd).context("making an adopted pty blocking")?;let master = portable_pty::unix::master_from_raw_fd(fd, pane.tty_name.map(PathBuf::from))?;let writer = master.take_writer()?;let snapshot_size = snapshot.size;@@ -985,6 +996,16 @@ pub fn wait_for_predecessor_exit(mut stream: UnixStream) {#[cfg(test)]mod tests {use super::*;++ #[test]+ fn an_adopted_nonblocking_descriptor_becomes_blocking() {+ let (end, _peer) = UnixStream::pair().unwrap();+ end.set_nonblocking(true).unwrap();+ let fd = OwnedFd::from(end);+ ensure_blocking(&fd).unwrap();+ let flags = rustix::fs::fcntl_getfl(&fd).unwrap();+ assert!(!flags.contains(rustix::fs::OFlags::NONBLOCK));+ }use thinkterm_proto::{PaneEntry, PaneStackEntry, SplitDirection, SplitDirectionAndSize};fn entry(pane_id: PaneId) -> PaneEntry {diff --git a/wezterm-mux-server-impl/src/session_import/pty.rs b/wezterm-mux-server-impl/src/session_import/pty.rsindex 02095f4b..509f8328 100644--- a/wezterm-mux-server-impl/src/session_import/pty.rs+++ b/wezterm-mux-server-impl/src/session_import/pty.rs@@ -9,6 +9,7 @@ use std::sync::Mutex;/// Duplicates are reserved before commit; dropping them only closes them./// Unlike UnixMasterWriter, these files never inject EOF when dropped.+/// They keep the source's O_NONBLOCK; a later live handoff clears it.#[derive(Debug)]pub struct ImportedPty {master: OwnedFd,