Skip to content

Commit b6e12dd

Browse files
authored
Check if stdin is a tty (#23)
1 parent d3824b0 commit b6e12dd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

RailControl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ along with RailControl; see the file LICENCE. If not see
2424
#include <iostream>
2525
#include <signal.h>
2626
#include <sstream>
27-
#include <unistd.h> //close;
27+
#include <unistd.h> //close; isatty
2828
#include <vector>
2929

3030
#include "ArgumentHandler.h"
@@ -183,7 +183,7 @@ int main (int argc, char* argv[])
183183
// wait for q or r followed by \n or SIGINT or SIGTERM
184184
do
185185
{
186-
if (silent)
186+
if (!isatty(STDIN_FILENO) || silent)
187187
{
188188
Utils::Utils::SleepForSeconds(1);
189189
}

0 commit comments

Comments
 (0)