From 3a23cf0a18b15b91aec783189d6e06eec10c581f Mon Sep 17 00:00:00 2001 From: Vex Date: Sun, 4 Oct 2026 21:25:54 -0300 Subject: [PATCH] Accept CRLF lines on the Linux server console The Linux console reader split stdin on '\n' only, so a line ending in "\r\n" kept its '\r': "quit" did not stop the server and every command answered Unknown command. Lines from a script saved on Windows, a hosting panel or telnet end that way. (The Windows reader uses std::getline on a text-mode stream, which already drops the '\r'.) Co-Authored-By: Claude Opus 5.5 --- Server/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Server/main.cpp b/Server/main.cpp index 6cd5e27..35e5463 100644 --- a/Server/main.cpp +++ b/Server/main.cpp @@ -190,6 +190,9 @@ struct Input { } for (ssize_t i = 0; i < count; ++i) { if (buffer[i] == '\n') { + // CRLF input (a script saved on Windows, a panel or telnet): without + // this, "quit\r" is an unknown command and the server keeps running. + if (!pending.empty() && pending.back() == '\r') pending.pop_back(); std::lock_guard lock(mutex); lines.push_back(pending); pending.clear();