Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Serialize legacy Windows PowerShell sandbox tests (#19453)

Dylan Hurd32aad7bd13e6
diff --git a/codex-rs/windows-sandbox-rs/src/unified_exec/tests.rs b/codex-rs/windows-sandbox-rs/src/unified_exec/tests.rs
index a2bc7bebf0..b0530a4fb4 100644
--- a/codex-rs/windows-sandbox-rs/src/unified_exec/tests.rs
+++ b/codex-rs/windows-sandbox-rs/src/unified_exec/tests.rs
@@ -14,6 +14,8 @@ use std::io::Seek;
use std::io::SeekFrom;
use std::path::Path;
use std::path::PathBuf;
+use std::sync::Mutex;
+use std::sync::MutexGuard;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering;
use std::time::Duration;
@@ -26,6 +28,13 @@ use tokio::sync::oneshot;
use tokio::time::timeout;
static TEST_HOME_COUNTER: AtomicU64 = AtomicU64::new(0);
+static LEGACY_PROCESS_TEST_LOCK: Mutex<()> = Mutex::new(());
+
+fn legacy_process_test_guard() -> MutexGuard<'static, ()> {
+ LEGACY_PROCESS_TEST_LOCK
+ .lock()
+ .expect("legacy Windows sandbox process test lock poisoned")
+}
fn current_thread_runtime() -> tokio::runtime::Runtime {
Builder::new_current_thread()
@@ -129,6 +138,7 @@ async fn collect_stdout_and_exit(
#[test]
fn legacy_non_tty_cmd_emits_output() {
+ let _guard = legacy_process_test_guard();
let runtime = current_thread_runtime();
runtime.block_on(async move {
let cwd = sandbox_cwd();
@@ -167,6 +177,7 @@ fn legacy_non_tty_powershell_emits_output() {
let Some(pwsh) = pwsh_path() else {
return;
};
+ let _guard = legacy_process_test_guard();
let runtime = current_thread_runtime();
runtime.block_on(async move {
let cwd = sandbox_cwd();
@@ -351,6 +362,7 @@ fn legacy_capture_powershell_emits_output() {
let Some(pwsh) = pwsh_path() else {
return;
};
+ let _guard = legacy_process_test_guard();
let cwd = sandbox_cwd();
let codex_home = sandbox_home("legacy-capture-pwsh");
println!("capture pwsh codex_home={}", codex_home.path().display());
@@ -387,6 +399,7 @@ fn legacy_tty_powershell_emits_output_and_accepts_input() {
let Some(pwsh) = pwsh_path() else {
return;
};
+ let _guard = legacy_process_test_guard();
let runtime = current_thread_runtime();
runtime.block_on(async move {
let cwd = sandbox_cwd();