| 1 |
From b6e12dde577fb5d52470f678973eeba4fd1fc7d3 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Bruno Kleinert <[email protected]> |
| 3 |
Date: Fri, 9 Jan 2026 10:41:25 +0100 |
| 4 |
Subject: [PATCH] Check if stdin is a tty (#23) |
| 5 |
|
| 6 |
--- |
| 7 |
RailControl.cpp | 4 ++-- |
| 8 |
1 file changed, 2 insertions(+), 2 deletions(-) |
| 9 |
|
| 10 |
Index: railcontrol/RailControl.cpp |
| 11 |
=================================================================== |
| 12 |
--- railcontrol.orig/RailControl.cpp 2026-01-11 04:40:55.434886196 +0100 |
| 13 |
+++ railcontrol/RailControl.cpp 2026-01-11 04:40:55.432273743 +0100 |
| 14 |
@@ -24,7 +24,7 @@ |
| 15 |
#include <iostream> |
| 16 |
#include <signal.h> |
| 17 |
#include <sstream> |
| 18 |
-#include <unistd.h> //close; |
| 19 |
+#include <unistd.h> //close; isatty |
| 20 |
#include <vector> |
| 21 |
|
| 22 |
#include "ArgumentHandler.h" |
| 23 |
@@ -155,7 +155,7 @@ |
| 24 |
// wait for q or r followed by \n or SIGINT or SIGTERM |
| 25 |
do |
| 26 |
{ |
| 27 |
- if (silent) |
| 28 |
+ if (!isatty(STDIN_FILENO) || silent) |
| 29 |
{ |
| 30 |
Utils::Utils::SleepForSeconds(1); |
| 31 |
} |