@@ -973,7 +973,7 @@ mod tests {
973973 fn sidecar_entry_resolves_to_the_vendored_package ( ) {
974974 // Guard against the dedup tests' concurrent FRESHELL_CLAUDE_SIDECAR mutation
975975 // (see CLAUDE_ENV_LOCK below) -- this test reads the SAME process-global env var.
976- let _guard = CLAUDE_ENV_LOCK . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) ;
976+ let _guard = CLAUDE_ENV_LOCK . blocking_lock ( ) ;
977977 std:: env:: remove_var ( "FRESHELL_CLAUDE_SIDECAR" ) ;
978978 // The compile-time path points at the vendored Node package beside this crate.
979979 let entry = sidecar_entry_path ( ) ;
@@ -994,7 +994,7 @@ mod tests {
994994 /// Serializes every test in this file that mutates process-global env vars
995995 /// (`FRESHELL_CLAUDE_SIDECAR` / `FRESHELL_CLAUDE_NODE`), mirroring codex's
996996 /// `ENV_LOCK` (`codex.rs`).
997- static CLAUDE_ENV_LOCK : std :: sync:: Mutex < ( ) > = std :: sync:: Mutex :: new ( ( ) ) ;
997+ static CLAUDE_ENV_LOCK : tokio :: sync:: Mutex < ( ) > = tokio :: sync:: Mutex :: const_new ( ( ) ) ;
998998
999999 /// A minimal scripted fake claude sidecar (no real `@anthropic-ai/claude-agent-sdk`,
10001000 /// no network, no cost): on `{"type":"create",...}` it appends a marker line to
@@ -1139,7 +1139,7 @@ rl.on('line', (line) => {
11391139 /// SAME session id on the second response.
11401140 #[ tokio:: test]
11411141 async fn handle_create_duplicate_request_id_reuses_the_session_and_spawns_once ( ) {
1142- let _guard = CLAUDE_ENV_LOCK . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) ;
1142+ let _guard = CLAUDE_ENV_LOCK . lock ( ) . await ;
11431143 let env = FakeClaudeSidecarEnv :: install ( ) ;
11441144 let ( tx, mut rx) = tokio:: sync:: broadcast:: channel :: < String > ( 64 ) ;
11451145 let st = FreshClaudeState :: new ( Arc :: new ( tx) ) ;
@@ -1170,7 +1170,7 @@ rl.on('line', (line) => {
11701170 /// must still spawn at most one sidecar and both resolve to the SAME session.
11711171 #[ tokio:: test]
11721172 async fn handle_create_concurrent_duplicate_request_id_spawns_at_most_once ( ) {
1173- let _guard = CLAUDE_ENV_LOCK . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) ;
1173+ let _guard = CLAUDE_ENV_LOCK . lock ( ) . await ;
11741174 let env = FakeClaudeSidecarEnv :: install ( ) ;
11751175 let ( tx, mut rx) = tokio:: sync:: broadcast:: channel :: < String > ( 64 ) ;
11761176 let st = FreshClaudeState :: new ( Arc :: new ( tx) ) ;
@@ -1200,7 +1200,7 @@ rl.on('line', (line) => {
12001200 /// Control: DISTINCT requestIds must never dedup against each other.
12011201 #[ tokio:: test]
12021202 async fn handle_create_distinct_request_ids_create_distinct_sessions ( ) {
1203- let _guard = CLAUDE_ENV_LOCK . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) ;
1203+ let _guard = CLAUDE_ENV_LOCK . lock ( ) . await ;
12041204 let env = FakeClaudeSidecarEnv :: install ( ) ;
12051205 let ( tx, mut rx) = tokio:: sync:: broadcast:: channel :: < String > ( 64 ) ;
12061206 let st = FreshClaudeState :: new ( Arc :: new ( tx) ) ;
@@ -1237,7 +1237,7 @@ rl.on('line', (line) => {
12371237 /// it is dropped rather than mirrored redundantly -- 4 tests, not 5.
12381238 #[ tokio:: test]
12391239 async fn handle_create_duplicate_after_explicit_kill_creates_a_fresh_session ( ) {
1240- let _guard = CLAUDE_ENV_LOCK . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) ;
1240+ let _guard = CLAUDE_ENV_LOCK . lock ( ) . await ;
12411241 let env = FakeClaudeSidecarEnv :: install ( ) ;
12421242 let ( tx, mut rx) = tokio:: sync:: broadcast:: channel :: < String > ( 64 ) ;
12431243 let st = FreshClaudeState :: new ( Arc :: new ( tx) ) ;
@@ -1330,7 +1330,7 @@ rl.on('line', (line) => {
13301330 /// assert on instead).
13311331 #[ tokio:: test]
13321332 async fn handle_interrupt_forwards_the_request_to_the_sidecar_for_a_known_session ( ) {
1333- let _guard = CLAUDE_ENV_LOCK . lock ( ) . unwrap_or_else ( |e| e . into_inner ( ) ) ;
1333+ let _guard = CLAUDE_ENV_LOCK . lock ( ) . await ;
13341334 let env = FakeClaudeSidecarEnv :: install ( ) ;
13351335 let ( tx, mut rx) = tokio:: sync:: broadcast:: channel :: < String > ( 64 ) ;
13361336 let st = FreshClaudeState :: new ( Arc :: new ( tx) ) ;
0 commit comments