summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJekyll Wu <adaptee@gmail.com>2012-01-12 19:18:47 (GMT)
committerJekyll Wu <adaptee@gmail.com>2012-01-12 19:18:47 (GMT)
commit595ccda304f4a1c6a54039ce2f5d2be0f1ba3c41 (patch)
tree5c390e7abbfc3621cf78bce3dc93fe90d2268eef
parentd90be331e852992beeffeab640682a667d81d673 (diff)
When --nofork option is specified, Konsole should alwasy use new process
The intention of using --nofork with Konsole is to start Konsole in foreground and wait for it to finish, so the only logical behavior is using new process instead of reusing existing process. CCBUG: 288200
-rw-r--r--src/main.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index e4fb048..dcd7eff 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -87,10 +87,10 @@ extern "C" int KDE_EXPORT kdemain(int argc, char** argv)
}
bool shouldUseNewProcess()
{
- KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
+ KCmdLineArgs* konsoleArgs = KCmdLineArgs::parsedArgs();
// the only way to create new tab is to reuse existing Konsole process.
- if ( args->isSet("new-tab") ) {
+ if ( konsoleArgs->isSet("new-tab") ) {
return false;
}
@@ -103,7 +103,15 @@ bool shouldUseNewProcess()
hasControllingTTY = true ;
}
- return hasControllingTTY;
+ KCmdLineArgs* kUniqueAppArgs = KCmdLineArgs::parsedArgs("kuniqueapp");
+
+ // when user asks konsole to run in foreground through the --nofork option
+ // provided by KUniqueApplication, we must use new process. Otherwise, there
+ // will be no process for users to wait for finishing.
+ bool shouldRunInForeground = !kUniqueAppArgs->isSet("fork");
+
+ return hasControllingTTY || shouldRunInForeground ;
+
}
void fillCommandLineOptions(KCmdLineOptions& options)