Skip to content

fix: conditionally pass -t flag to docker exec based on TTY detection#2023

Merged
jlaneve merged 1 commit intomainfrom
fix/tty-detection-docker-exec
Mar 3, 2026
Merged

fix: conditionally pass -t flag to docker exec based on TTY detection#2023
jlaneve merged 1 commit intomainfrom
fix/tty-detection-docker-exec

Conversation

@jlaneve
Copy link
Contributor

@jlaneve jlaneve commented Mar 3, 2026

Summary

  • Fixes hardcoded -it flags in docker exec calls that caused the input device is not a TTY errors in non-interactive environments (CI/CD, IDE terminals, cron, piped shells)
  • Now detects whether stdin is a terminal and only passes -t when appropriate, while always keeping -i for stdin attachment
  • Applies the fix to both AirflowCommand() in docker/docker.go (used by airflow_settings.yaml import for pools/connections/variables) and Bash() in airflow/docker.go (used by astro dev bash)

Closes #2022

Test plan

  • go build ./... compiles cleanly
  • go test ./docker/ — 19 tests pass
  • go test ./settings/ — 27 tests pass
  • go test ./airflow/ — 150+ tests pass (including TestUseBash)
  • Verified in non-TTY environment: -t is correctly omitted, args are exec -i <container> bash -c <cmd>
  • No new dependencies — golang.org/x/term was already in go.mod
  • Manual test: astro dev start with airflow_settings.yaml pools/connections/variables in a CI-like environment
  • Manual test: astro dev bash in an interactive terminal still works as before

🤖 Generated with Claude Code

The -it flags were hardcoded in docker exec calls, causing "the input
device is not a TTY" errors in non-interactive environments like CI/CD
pipelines, IDE terminals, cron jobs, and piped shells.

Now only passes -t when stdin is actually a terminal, while always
keeping -i for stdin attachment. Fixes both AirflowCommand() (used by
airflow_settings.yaml import for pools/connections/variables) and
Bash() (used by astro dev bash).

Closes #2022

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jlaneve jlaneve requested a review from a team as a code owner March 3, 2026 15:09
@jlaneve jlaneve merged commit 15903d2 into main Mar 3, 2026
3 of 5 checks passed
@jlaneve jlaneve deleted the fix/tty-detection-docker-exec branch March 3, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker exec -it in AirflowCommand fails in non-interactive shells (pools/connections/variables)

2 participants