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
wilder-portage
Jekyll Wu 14 years ago
parent d90be331e8
commit 595ccda304
  1. 14
      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)

Loading…
Cancel
Save