From d90be331e852992beeffeab640682a667d81d673 Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Fri, 13 Jan 2012 01:55:44 +0800 Subject: [PATCH] Make minor adjustment as preparation for further changes. --- src/main.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index dfa876fd8..e4fb04801 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,18 +87,23 @@ extern "C" int KDE_EXPORT kdemain(int argc, char** argv) } bool shouldUseNewProcess() { + KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); + + // the only way to create new tab is to reuse existing Konsole process. + if ( args->isSet("new-tab") ) { + return false; + } + // when starting Konsole from a terminal, a new process must be used // so that the current environment is propagated into the shells of the new // Konsole and any debug output or warnings from Konsole are written to // the current terminal - KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); - bool hasControllingTTY = false ; if ( open("/dev/tty", O_RDONLY) != -1 ) { hasControllingTTY = true ; } - return hasControllingTTY && !args->isSet("new-tab"); + return hasControllingTTY; } void fillCommandLineOptions(KCmdLineOptions& options)