mirror of
https://github.com/openai/codex.git
synced 2026-11-12 06:40:35 +00:00
Move shell snapshot scripts into codex-shell-command (#39281)
## What changed - Add a public `snapshot_script` helper to `codex-shell-command` for Bash, Zsh, POSIX shell, and PowerShell, returning `None` for Command Prompt. - Update `codex-core` and its shell snapshot tests to use the shared helper without changing snapshot behavior. GitOrigin-RevId: 779b9dc964635b717922ea9f5646b94c4dbb0da1
This commit is contained in:
1 parent
88c39c4578
commit
681c82f497
4 files changed
+217
-203
No files matched your search
@@ -128,7 +128,7 @@ fn snapshot_file_name_parser_supports_legacy_and_suffixed_names() {
|
||||
fn bash_snapshot_filters_invalid_exports() -> Result<()> {
|
||||
let output = Command::new("/bin/bash")
|
||||
.arg("-c")
|
||||
.arg(bash_snapshot_script())
|
||||
.arg(snapshot_script(ShellType::Bash).expect("bash supports snapshots"))
|
||||
.env("BASH_ENV", "/dev/null")
|
||||
.env("VALID_NAME", "ok")
|
||||
.env("PWD", "/tmp/stale")
|
||||
@@ -153,7 +153,7 @@ fn bash_snapshot_preserves_multiline_exports() -> Result<()> {
|
||||
let multiline_cert = "-----BEGIN CERTIFICATE-----\nabc\n-----END CERTIFICATE-----";
|
||||
let output = Command::new("/bin/bash")
|
||||
.arg("-c")
|
||||
.arg(bash_snapshot_script())
|
||||
.arg(snapshot_script(ShellType::Bash).expect("bash supports snapshots"))
|
||||
.env("BASH_ENV", "/dev/null")
|
||||
.env("MULTILINE_CERT", multiline_cert)
|
||||
.output()?;
|
||||
@@ -209,7 +209,7 @@ fn zsh_snapshot_restores_tied_path() -> Result<()> {
|
||||
let snapshot = Command::new("/bin/zsh")
|
||||
.arg("-f")
|
||||
.arg("-c")
|
||||
.arg(zsh_snapshot_script())
|
||||
.arg(snapshot_script(ShellType::Zsh).expect("zsh supports snapshots"))
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin")
|
||||
.env("ZDOTDIR", dir.path())
|
||||
@@ -246,7 +246,7 @@ fn zsh_snapshot_restores_tied_path() -> Result<()> {
|
||||
let readonly_snapshot = Command::new("/bin/zsh")
|
||||
.arg("-f")
|
||||
.arg("-c")
|
||||
.arg(zsh_snapshot_script())
|
||||
.arg(snapshot_script(ShellType::Zsh).expect("zsh supports snapshots"))
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin")
|
||||
.env("ZDOTDIR", dir.path())
|
||||
@@ -376,7 +376,7 @@ async fn snapshot_shell_does_not_inherit_stdin() -> Result<()> {
|
||||
let home_display = home.display();
|
||||
let script = format!(
|
||||
"HOME=\"{home_display}\"; export HOME; {}",
|
||||
bash_snapshot_script()
|
||||
snapshot_script(ShellType::Bash).expect("bash supports snapshots")
|
||||
);
|
||||
let output = run_script_with_timeout(
|
||||
&shell,
|
||||
|
||||
Reference in new issue
Block a user