mirror of
https://github.com/openai/codex.git
synced 2026-05-18 18:22:39 +00:00
fix: add noninteractive install script mode
This commit is contained in:
@@ -27,6 +27,10 @@ function Prompt-YesNo {
|
||||
[string]$Prompt
|
||||
)
|
||||
|
||||
if ($env:CODEX_INSTALL_SCRIPT_NONINTERACTIVE -eq "true") {
|
||||
return $false
|
||||
}
|
||||
|
||||
if ([Console]::IsInputRedirected -or [Console]::IsOutputRedirected) {
|
||||
return $false
|
||||
}
|
||||
|
||||
@@ -60,6 +60,9 @@ parse_args() {
|
||||
--help | -h)
|
||||
cat <<EOF
|
||||
Usage: install.sh [--release VERSION]
|
||||
|
||||
Environment:
|
||||
CODEX_INSTALL_SCRIPT_NONINTERACTIVE=true Skip prompts and use default answers.
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
@@ -488,6 +491,10 @@ classify_existing_codex() {
|
||||
prompt_yes_no() {
|
||||
prompt="$1"
|
||||
|
||||
if [ "${CODEX_INSTALL_SCRIPT_NONINTERACTIVE:-}" = "true" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ( : </dev/tty ) 2>/dev/null; then
|
||||
printf '%s [y/N] ' "$prompt" >/dev/tty
|
||||
if ! IFS= read -r answer </dev/tty; then
|
||||
|
||||
Reference in New Issue
Block a user