Skip to content

Fix Issue #359: Unable to take input through CLI or terminal#417

Open
muien5080 wants to merge 1 commit intoJdeRobot:masterfrom
muien5080:fix/issue-359-eoferror
Open

Fix Issue #359: Unable to take input through CLI or terminal#417
muien5080 wants to merge 1 commit intoJdeRobot:masterfrom
muien5080:fix/issue-359-eoferror

Conversation

@muien5080
Copy link

Description
#359 Fixed
Fixes the EOFError crash that occurs when synthesized code blocks use input()
to get user input from the terminal.

Problem
When user code blocks call input(), the program crashes with:

This happens because synthesized code runs in subprocess contexts where stdin
is not connected to the terminal.

Solution
Added a simple input wrapper in main() that:

  • Catches EOFError from input() calls
  • Returns an empty string "" instead of crashing
  • Allows user code to continue executing

Changes

  • Modified backend/staticfiles/synthesis/main.py
    • Added 10-line wrapper function in main()
    • No breaking changes, fully backward compatible

Testing
User code blocks can now safely use input() without crashing in subprocess contexts.

AI Assistance
This pull request (PR) was enhanced with the assistance of AI tools like ChatGPT. AI helped with code review, suggesting an appropriate branch name, and optimizing the design of the PR description.

---Note---
I've worked on this independently and am interested in contributing to JdeRobot.
I'm willing to participate in GSoC 2026 and would appreciate the opportunity
to collaborate with this amazing project.

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.

1 participant