mirror of
https://github.com/openai/codex.git
synced 2026-11-06 20:20:34 +00:00
Preserve installer stderr when releasing the install lock (#59227)
## Why Redirecting stderr on `exec` while closing the lock descriptor suppressed subsequent installer warnings, including the warning that an existing npm-managed Codex installation remains installed. ## What changed Remove the stderr redirection from `release_install_lock` when closing file descriptor 9. Add a regression test asserting that a noninteractive install succeeds and emits the existing npm installation warning. GitOrigin-RevId: 5a35ccd9bf62afb99cc949892ec724a01e2d9eee
This commit is contained in:
@@ -743,7 +743,7 @@ release_install_lock() {
|
||||
if [ "$lock_kind" = "mkdir" ]; then
|
||||
rm -rf "$LOCK_DIR" 2>/dev/null || true
|
||||
elif [ "$lock_kind" = "flock" ] || [ "$lock_kind" = "lockf" ]; then
|
||||
exec 9>&- 2>/dev/null || true
|
||||
exec 9>&-
|
||||
fi
|
||||
lock_kind=""
|
||||
}
|
||||
|
||||
@@ -135,6 +135,27 @@ class InstallShTest(unittest.TestCase):
|
||||
)
|
||||
self.assertTrue(os.access(host_path, os.X_OK))
|
||||
|
||||
def test_noninteractive_install_warns_about_existing_npm_codex(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
root = Path(temp_dir)
|
||||
archive, checksum, metadata = create_package_release(root)
|
||||
(root / "bin").mkdir()
|
||||
write_executable(root / "bin" / "codex", "#!/usr/bin/env node\n")
|
||||
|
||||
result, _ = run_installer_in(
|
||||
root,
|
||||
VERSION,
|
||||
metadata_json=metadata,
|
||||
archive_path=archive,
|
||||
checksum_path=checksum,
|
||||
force_macos=True,
|
||||
)
|
||||
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn(
|
||||
"Leaving the existing npm-managed Codex installed", result.stderr
|
||||
)
|
||||
|
||||
def test_releases_latest_installs_verified_package_by_default(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
root = Path(temp_dir)
|
||||
|
||||
Reference in New Issue
Block a user