Skip to content

Conversation

@shivapaliwal
Copy link

Problem

Docker startup fails with EOFError when the seed script prompts for user input in non-interactive environments (Docker/CI). Additionally, on Windows, shell scripts with CRLF line endings cause bash\r errors.

Solution

This PR implements two fixes:

  1. Interactive Input Detection: Added sys.stdin.isatty() check in scripts/seed.py to detect non-interactive environments and skip reseeding gracefully with a helpful message instead of crashing.

  2. Line Ending Enforcement: Created .gitattributes to enforce LF line endings for all shell scripts, preventing Windows CRLF issues in Docker containers.

Changes

  • Added sys.stdin.isatty() check to detect Docker/CI environments
  • Skip reseeding gracefully in non-interactive mode instead of crashing
  • Add .gitattributes to enforce LF line endings for shell scripts
  • Normalize line endings for startup scripts

Testing

Tested on Windows with Docker Desktop:

  • ✅ Shell scripts execute without bash\r errors
  • ✅ Migrations run successfully
  • ✅ Seed command works on empty database without EOFError
  • ✅ Container starts and runs successfully

References

Screenshots

Before fix: Container crashed with /usr/bin/env: 'bash\r': No such file or directory
After fix: Container starts successfully and runs migrations

…onments

- Add sys.stdin.isatty() check to detect Docker/CI environments

- Skip reseeding gracefully in non-interactive mode instead of crashing

- Add .gitattributes to enforce LF line endings for shell scripts

- Normalize line endings for startup scripts

- Fixes EOFError and bash\r issues on Windows
- Prioritize settings.TEST check before interactive mode check

- Allows test suite to reseed multiple times

- Maintains EOFError protection for production Docker/CI
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 startup fails due to interactive input in seed command

1 participant