Skip to content

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

Open
eliot-portevin wants to merge 1 commit intosauterl:masterfrom
eliot-portevin:master
Open

chore: headless server handles null input instead of closing immediately#8
eliot-portevin wants to merge 1 commit intosauterl:masterfrom
eliot-portevin:master

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