From d729d69ea360cc802e02ea84d96a1db1fe78ea53 Mon Sep 17 00:00:00 2001 From: John Burwell Date: Thu, 31 Aug 2023 12:41:23 -0500 Subject: [PATCH] adjust line endings depending on invocation --- rsbbs/console.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rsbbs/console.py b/rsbbs/console.py index 862a51a..ce0fa1a 100644 --- a/rsbbs/console.py +++ b/rsbbs/console.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import io import logging import sys @@ -42,6 +43,15 @@ class Console(): self.pluginloader = PluginLoader(self) self.pluginloader.load_plugins() + # Configure stdin and stdout newlines and encoding + # when invoked by ax25: + if not sys.stdin.isatty(): + sys.stdout = io.TextIOWrapper(sys.stdout.detach(), + newline=None) + + sys.stdin = io.TextIOWrapper(sys.stdin.detach(), + newline=None) + # # Input and output #