Skip to content

Commit

Permalink
Merge pull request serverstf#59 from CzBiX/patch-1
Browse files Browse the repository at this point in the history
Exit the rcon shell by Ctrl-D shortcut.
  • Loading branch information
Yepoleb authored Nov 8, 2017
2 parents 2cfbaa5 + c2981c7 commit 5351491
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions valve/rcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,9 @@ def _disconnect(self):
self._convars = ()
self.prompt = self._INITIAL_PROMPT

def _exit(self):
self._disconnect()

def default(self, command):
"""Issue a command as an RCON command.
Expand Down Expand Up @@ -776,6 +779,11 @@ def do_exit(self, _):
print("Use !exit to exit this shell or "
"!shutdown to shutdown the server.")

def do_EOF(self, _):
"""Exit by the Ctrl-D shortcut."""
self._exit()
return True

def do_help(self, command):
"""Print out ConVar-specific or generic help.
Expand Down Expand Up @@ -818,6 +826,7 @@ def do_shell(self, command_string):

def do_shell_exit(self, argv):
"""Exit the shell."""
self._exit()
return True

def do_shell_connect(self, argv):
Expand Down

0 comments on commit 5351491

Please sign in to comment.