If the game server is paused, the log won't be updated with the magic strings generated by send_cmd, and the script will hang until the server in unpaused.
This is particularly deleterious in the event of a system shutdown while the game server is paused. The init script will hang trying to send players a helpful message and ultimately fail to ever send the TERM signal to the game server. Without the signal, the game server won't shutdown cleanly and won't save the current game state before the system goes down. The next time the server comes up, the game will be reverted to the last autosave.
This patch changes send_cmd so that it only waits for output if the -o option is passed, such as when a list of players is requested. When simply posting helpful messages to players, send_cmd will never block.
If the game server is paused, the log won't be updated with the magic strings generated by send_cmd, and the script will hang until the server in unpaused.
This is particularly deleterious in the event of a system shutdown while the game server is paused. The init script will hang trying to send players a helpful message and ultimately fail to ever send the TERM signal to the game server. Without the signal, the game server won't shutdown cleanly and won't save the current game state before the system goes down. The next time the server comes up, the game will be reverted to the last autosave.
This patch changes send_cmd so that it only waits for output if the -o option is passed, such as when a list of players is requested. When simply posting helpful messages to players, send_cmd will never block.