diff --git a/src/main.cpp b/src/main.cpp index 560f00d5..dfa876fd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,6 +23,8 @@ // Unix #include +#include +#include // KDE #include @@ -31,9 +33,6 @@ #define KONSOLE_VERSION "2.8.999" -// standard input file descriptor -static const int STDIN = 0; - using Konsole::Application; // fill the KAboutData structure with information about contributors to Konsole. @@ -93,7 +92,13 @@ bool shouldUseNewProcess() // Konsole and any debug output or warnings from Konsole are written to // the current terminal KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - return isatty(STDIN) && !args->isSet("new-tab"); + + bool hasControllingTTY = false ; + if ( open("/dev/tty", O_RDONLY) != -1 ) { + hasControllingTTY = true ; + } + + return hasControllingTTY && !args->isSet("new-tab"); } void fillCommandLineOptions(KCmdLineOptions& options)