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

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");
let resized = tokio::time::timeout(tokio::time::Duration::from_secs(2), size_rx)
.await
.map_err(|_| anyhow::anyhow!("timed out waiting for resize"))?
.expect("receive resized terminal size");
assert_eq!(resized, TerminalSize { rows: 40, cols: 120 });
assert_eq!(
resized,
TerminalSize {
rows: 40,
cols: 120
}
);
Ok(())
}

View File

@@ -536,7 +536,9 @@ fn resize_conpty_handle(
if result == 0 {
Ok(())
} 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
&& let Ok(mut guard) = hpc.lock()
&& let Some(hpc) = guard.take()
{
unsafe {
ClosePseudoConsole(hpc);
if let Some(hpc) = hpc_for_wait {
if let Ok(mut guard) = hpc.lock() {
if let Some(hpc) = guard.take() {
unsafe {
ClosePseudoConsole(hpc);
}
}
}
}
unsafe {

View File

@@ -305,7 +305,11 @@ fn runner_resizer_sends_resize_frame() {
let pipe_write = std::sync::Arc::new(std::sync::Mutex::new(file));
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()
.read(true)