From e0d2446f95c5ba4d8f0f019a29c2d58c9ad5c51b Mon Sep 17 00:00:00 2001 From: computergeek125 Date: Mon, 17 Jun 2024 20:08:12 -0500 Subject: [PATCH] Moved the newline initializer to the constructor for the server, still should be non-breaking --- app/classes/shared/server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 9f3b3357..0db1b50d 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -161,10 +161,11 @@ class ServerInstance: stats: Stats stats_helper: HelperServerStats - def __init__(self, server_id, helper, management_helper, stats, file_helper): + def __init__(self, server_id, helper, management_helper, stats, file_helper, newline=os.linesep): self.helper = helper self.file_helper = file_helper self.management_helper = management_helper + self.newline = newline # holders for our process self.process = None self.line = False @@ -578,7 +579,7 @@ class ServerInstance: self.stats_helper.finish_import() return False - out_buf = ServerOutBuf(self.helper, self.process, self.server_id) + out_buf = ServerOutBuf(self.helper, self.process, self.server_id, newline=self.newline) logger.debug(f"Starting virtual terminal listener for server {self.name}") threading.Thread( @@ -985,7 +986,7 @@ class ServerInstance: logger.debug(f"Sending command {command} to server") # send it - self.process.stdin.write(f"{command}\n".encode("utf-8")) + self.process.stdin.write(f"{command}{self.newline}".encode("utf-8")) self.process.stdin.flush() return True