fix: make hook precedence tests portable

Co-authored-by: Codex noreply@openai.com
This commit is contained in:
viyatb-oai
2026-04-16 16:55:29 -07:00
co-authored by Codex noreply@openai.com
parent 6ea0cae246
commit 4982c9751f
4 changed files with 8 additions and 10 deletions
-1
View File
@@ -2284,7 +2284,6 @@ version = "0.0.0"
dependencies = [
"anyhow",
"chrono",
"codex-app-server-protocol",
"codex-config",
"codex-protocol",
"codex-utils-absolute-path",
-1
View File
@@ -15,7 +15,6 @@ workspace = true
[dependencies]
anyhow = { workspace = true }
chrono = { workspace = true, features = ["serde"] }
codex-app-server-protocol = { workspace = true }
codex-config = { workspace = true }
codex-protocol = { workspace = true }
codex-utils-absolute-path = { workspace = true }
+4 -4
View File
@@ -397,15 +397,15 @@ mod tests {
(
"cmd.exe".to_string(),
vec!["/D".to_string(), "/C".to_string()],
r#"echo {^"continue^":false,^"stopReason^":^"pause^",^"hookSpecificOutput^":{^"hookEventName^":^"SessionStart^",^"additionalContext^":^"trusted context^"}}"#.to_string(),
"type nul > project-ran && echo project context".to_string(),
r#"more > nul && echo {^"continue^":false,^"stopReason^":^"pause^",^"hookSpecificOutput^":{^"hookEventName^":^"SessionStart^",^"additionalContext^":^"trusted context^"}}"#.to_string(),
"more > nul && type nul > project-ran && echo project context".to_string(),
)
} else {
(
"/bin/sh".to_string(),
vec!["-c".to_string()],
"printf '%s' '{\"continue\":false,\"stopReason\":\"pause\",\"hookSpecificOutput\":{\"hookEventName\":\"SessionStart\",\"additionalContext\":\"trusted context\"}}'".to_string(),
"touch project-ran && printf 'project context'".to_string(),
"cat >/dev/null; printf '%s' '{\"continue\":false,\"stopReason\":\"pause\",\"hookSpecificOutput\":{\"hookEventName\":\"SessionStart\",\"additionalContext\":\"trusted context\"}}'".to_string(),
"cat >/dev/null; touch project-ran && printf 'project context'".to_string(),
)
};
let handlers = vec![
@@ -454,15 +454,15 @@ mod tests {
(
"cmd.exe".to_string(),
vec!["/D".to_string(), "/C".to_string()],
r#"echo {^"decision^":^"block^",^"reason^":^"slow down^",^"hookSpecificOutput^":{^"hookEventName^":^"UserPromptSubmit^",^"additionalContext^":^"trusted context^"}}"#.to_string(),
"type nul > project-ran && echo project context".to_string(),
r#"more > nul && echo {^"decision^":^"block^",^"reason^":^"slow down^",^"hookSpecificOutput^":{^"hookEventName^":^"UserPromptSubmit^",^"additionalContext^":^"trusted context^"}}"#.to_string(),
"more > nul && type nul > project-ran && echo project context".to_string(),
)
} else {
(
"/bin/sh".to_string(),
vec!["-c".to_string()],
"printf '%s' '{\"decision\":\"block\",\"reason\":\"slow down\",\"hookSpecificOutput\":{\"hookEventName\":\"UserPromptSubmit\",\"additionalContext\":\"trusted context\"}}'".to_string(),
"touch project-ran && printf 'project context'".to_string(),
"cat >/dev/null; printf '%s' '{\"decision\":\"block\",\"reason\":\"slow down\",\"hookSpecificOutput\":{\"hookEventName\":\"UserPromptSubmit\",\"additionalContext\":\"trusted context\"}}'".to_string(),
"cat >/dev/null; touch project-ran && printf 'project context'".to_string(),
)
};
let handlers = vec![