Fix Windows sandbox session formatting and syntax

This commit is contained in:
iceweasel-oai
2026-03-23 14:52:20 -07:00
parent 427100f11c
commit 72ead59eaa
3 changed files with 26 additions and 10 deletions
+11 -2
View File
@@ -668,14 +668,23 @@ async fn driver_backed_process_can_resize_via_resizer_hook() -> anyhow::Result<(
})), })),
}); });
spawned.session.resize(TerminalSize { rows: 40, cols: 120 })?; spawned.session.resize(TerminalSize {
rows: 40,
cols: 120,
})?;
exit_tx.send(0).expect("send exit code"); exit_tx.send(0).expect("send exit code");
let resized = tokio::time::timeout(tokio::time::Duration::from_secs(2), size_rx) let resized = tokio::time::timeout(tokio::time::Duration::from_secs(2), size_rx)
.await .await
.map_err(|_| anyhow::anyhow!("timed out waiting for resize"))? .map_err(|_| anyhow::anyhow!("timed out waiting for resize"))?
.expect("receive resized terminal size"); .expect("receive resized terminal size");
assert_eq!(resized, TerminalSize { rows: 40, cols: 120 }); assert_eq!(
resized,
TerminalSize {
rows: 40,
cols: 120
}
);
Ok(()) Ok(())
} }
@@ -536,7 +536,9 @@ fn resize_conpty_handle(
if result == 0 { if result == 0 {
Ok(()) Ok(())
} else { } else {
Err(anyhow::anyhow!("failed to resize console: HRESULT {result}")) Err(anyhow::anyhow!(
"failed to resize console: HRESULT {result}"
))
} }
} }
@@ -662,12 +664,13 @@ pub async fn spawn_windows_sandbox_session_legacy(
} }
} }
} }
if let Some(hpc) = hpc_for_wait if let Some(hpc) = hpc_for_wait {
&& let Ok(mut guard) = hpc.lock() if let Ok(mut guard) = hpc.lock() {
&& let Some(hpc) = guard.take() if let Some(hpc) = guard.take() {
{ unsafe {
unsafe { ClosePseudoConsole(hpc);
ClosePseudoConsole(hpc); }
}
} }
} }
unsafe { unsafe {
@@ -305,7 +305,11 @@ fn runner_resizer_sends_resize_frame() {
let pipe_write = std::sync::Arc::new(std::sync::Mutex::new(file)); let pipe_write = std::sync::Arc::new(std::sync::Mutex::new(file));
let mut resizer = super::make_runner_resizer(pipe_write); let mut resizer = super::make_runner_resizer(pipe_write);
resizer(codex_utils_pty::TerminalSize { rows: 45, cols: 132 }).expect("send resize frame"); resizer(codex_utils_pty::TerminalSize {
rows: 45,
cols: 132,
})
.expect("send resize frame");
let mut reader = OpenOptions::new() let mut reader = OpenOptions::new()
.read(true) .read(true)