Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: headless server handles null input instead of closing immediately #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eliot-portevin
Copy link

Running the jar using ProcessBuilder resulted in an immediate exit of the game. This was due to the fact that the Scanner in the headless server detected no input and therefore decided to exit.

Note: when a player exits their lobby, the server receives several NullPointerExceptions because player.getLobby() is null. The game still works though.

Note 2: the gradle version was changed to 8.5 to work with java 21, this mustn't stay as such

@sauterl sauterl requested a review from Spiess August 14, 2024 11:07
Copy link
Collaborator

@Spiess Spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Is there any way to prevent the headless server from exiting when run with ProcessBuilder while preserving ctrl-D exit behavior?
If not this is fine, but if there was a way to keep this in that would be preferable.

@eliot-portevin
Copy link
Author

According to stackoverflow, CTRL+D sends an EOF signal to the command line. I'm not aware of how we could differentiate this from a null input, but since the game already takes a quit command to exit, this "feature" isn't lost.

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.

2 participants