refactor: simplify live handoff setup

refs #3651
This commit is contained in:
Jonathan Liebig
2026-09-15 22:08:50 +02:00
committed by GitHub
parent 5f17dc10e4
commit 72724ace15
4 changed files with 2 additions and 49 deletions
-40
View File
@@ -1303,10 +1303,6 @@ impl PaneRuntimeIo {
}
#[cfg(windows)]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
fn windows_handoff_supported(&self) -> bool {
match self {
PaneRuntimeIo::Actor(actor) => actor.supports_handoff(),
@@ -1316,10 +1312,6 @@ impl PaneRuntimeIo {
}
#[cfg(windows)]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
fn duplicate_windows_handoff(
&self,
target: &std::process::Child,
@@ -1343,10 +1335,6 @@ impl PaneRuntimeIo {
}
#[cfg(any(unix, windows))]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
fn begin_handoff(&self, timeout: std::time::Duration) -> std::io::Result<()> {
match self {
PaneRuntimeIo::Actor(actor) => actor.begin_handoff(timeout),
@@ -1356,10 +1344,6 @@ impl PaneRuntimeIo {
}
#[cfg(any(unix, windows))]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
fn set_handoff_paused(&self, paused: bool) -> std::io::Result<()> {
match self {
PaneRuntimeIo::Actor(actor) => {
@@ -1375,10 +1359,6 @@ impl PaneRuntimeIo {
}
#[cfg(any(unix, windows))]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
fn release_after_commit(&self) -> std::io::Result<()> {
match self {
PaneRuntimeIo::Actor(actor) => actor.release_after_commit(),
@@ -1928,19 +1908,11 @@ impl PaneRuntime {
}
#[cfg(windows)]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
pub(crate) fn windows_handoff_supported(&self) -> bool {
self.io.windows_handoff_supported()
}
#[cfg(windows)]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
pub(crate) fn duplicate_windows_handoff(
&self,
target: &std::process::Child,
@@ -1949,10 +1921,6 @@ impl PaneRuntime {
}
#[cfg(any(unix, windows))]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
pub fn preserve_for_handoff(mut self) {
if let Err(err) = self.io.release_after_commit() {
warn!(
@@ -1990,10 +1958,6 @@ impl PaneRuntime {
}
#[cfg(any(unix, windows))]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
pub fn set_handoff_reader_paused(&self, paused: bool) {
if let Err(err) = self.io.set_handoff_paused(paused) {
warn!(
@@ -2006,10 +1970,6 @@ impl PaneRuntime {
}
#[cfg(any(unix, windows))]
#[cfg_attr(
windows,
allow(dead_code, reason = "used by the stacked Windows handoff integration")
)]
pub fn pause_handoff_reader(&self, timeout: std::time::Duration) -> std::io::Result<()> {
self.io.begin_handoff(timeout)
}
-1
View File
@@ -331,7 +331,6 @@ pub(crate) fn accept_windows_handoff(
panes: Vec<crate::pty::backend::WindowsPtyHandoff>,
listeners: [crate::platform::WindowsListenerHandoff; 2],
) -> io::Result<HandoffStream> {
crate::platform::ensure_same_process_session(child.id())?;
let deadline = std::time::Instant::now() + READY_TIMEOUT;
let stream = loop {
match listener.accept() {
+1 -4
View File
@@ -190,16 +190,13 @@ fn run_handoff_import_server(socket_path: &Path, token: &str) -> io::Result<()>
event_hub.clone(),
should_quit.clone(),
)?;
let mut server = HeadlessServer::new(
let server = HeadlessServer::new(
app,
&loaded_config.diagnostics,
Some(api_tx.clone()),
Some(api_server),
should_quit,
)?;
// Carried across before any client attaches, so the first title sent is
// the override rather than the configured one it replaced.
server.api_window_title = received.manifest.api_window_title.clone();
crate::server::handoff::report_ready(&mut received.stream)?;
crate::server::handoff::wait_committed(&mut received.stream)?;
server
+1 -4
View File
@@ -113,14 +113,11 @@ impl HeadlessServer {
params.expected_version,
self.api_window_title.clone(),
);
import_child = Some(handoff::spawn_handoff_import(
let child = import_child.insert(handoff::spawn_handoff_import(
params.import_exe.as_deref().map(Path::new),
&socket_path,
&token,
)?);
let child = import_child
.as_ref()
.ok_or_else(|| io::Error::other("replacement child unavailable"))?;
#[cfg(windows)]
let mut stream = {
crate::platform::ensure_same_process_session(child.id())?;