Bug 262169 - Terminal emulator konsole automatically starts in background instead of foreground
Summary: Terminal emulator konsole automatically starts in background instead of foreg...
Alias: None
Product: konsole
Classification: Unclassified
Component: general (show other bugs)
Version: 2.9
Platform: Ubuntu Packages Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Konsole Developer
Depends on:
Reported: 2011-01-05 11:19 UTC by martin.babutzka
Modified: 2017-02-13 18:45 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description martin.babutzka 2011-01-05 11:19:17 UTC
Version:           2.4.5 (using KDE 4.4.5) 
OS:                Linux

In opposite to all other terminal emulators I tested (gnome-terminal, xterm, xfce4-terminal, xvt, mrxvt) konsole is the only one automatically running in background. This should clearly be not the case and for any application starting in foreground shells have possibilities to move a process to background but its not working if the process is automatically launched in background.
This mainly theoretical bug becomes problematic for example if you want to start only a konsole-Window as custom command within NX-compression (NeatX). NeatX is starting commands with "bash -c <command>", if the process automatically starts in background, bash returns immediately 0 and the NX connection is closed again. I would imagine this issue is easy to fix but also necessary as there should be no reason why konsole differs in functionality from all other terminal emulators. Thanks.

Reproducible: Always

Steps to Reproduce:
Start konsole from any terminal emulator and hit <Enter> in the parent terminal emulator to proof it is started as background process.
In case of NX (NeatX) usage: Start NX session with custom command "konsole".

Actual Results:  
In case of NX (NeatX) usage: konsole opens up and immediately closes again.

Expected Results:  
In case of NX (NeatX) usage: konsole should stay opened.

konsole --version output:
Qt: 4.6.2
KDE: 4.4.5 (KDE 4.4.5)
Konsole: 2.4.5

uname -a output:
Linux ikkatrinsrv1 2.6.32-26-generic #48-Ubuntu SMP Wed Nov 24 10:14:11 UTC 2010 x86_64 GNU/Linux
Comment 1 Roberto Ragusa 2011-05-20 13:18:05 UTC
Still no option to force foreground mode??? Unbelievable.

Scripts like
  konsole -e "ssh somewhere dosomething"
  echo "done"
are impossible because the echo command is executed immediately and there is no way to wait for konsole termination.

qt: 4.7.2
kde: 4.6.2
konsole: 2.6.2
Comment 2 Robert Knight 2011-05-20 15:24:33 UTC
Roberto - You can use the --nofork option
Comment 3 Roberto Ragusa 2011-05-20 20:34:52 UTC
Robert - Thank you. The --nofork option actually works. But it is not documented; not in --help at least....
Maybe the bug can be closed after just documenting the --nofork option.
Comment 4 Kurt Hindenburg 2011-06-12 02:32:31 UTC
--nofork shows up under --help-kde
Comment 5 martin.babutzka 2011-06-12 11:36:27 UTC
Is there any understandable reason to not use the --nofork option as default? This could help a lot of programs and scripts waiting for the process termination.
However starting a process in background is such a simple and elementary task that even a Linux beginner is capable to fork e.g. konsole if he likes to. Finding the --nofork option when using --help-kde is not very intuitive.
Comment 6 Roberto Ragusa 2011-06-12 17:18:03 UTC
I have to admit that I - while being using KDE every day since 1998 - completely missed the --nofork option hidden in --help-kde. So it is indeed not intuitive.

I agree with the proposal to have --nofork as the default.
Comment 7 Robert Knight 2011-06-14 18:24:23 UTC
> Is there any understandable reason to not use the --nofork option as default

Yes.  Konsole uses a single process for all terminal windows by default to facilitate improved startup time and resource sharing amongst windows and also enables some features like dragging and dropping tabs between windows.
Comment 8 frautukka 2011-07-25 07:46:31 UTC
We have discussed this behaviour also here:
where it also effects the -e option.

I don't care what the default behaviour is, as long as it is well documented. That means, not only on the command line help, but also in the KDE GUI Help it should clearly be mention. Please see the bug report I mentioned, to know where I would like to see a better documentation. It should be stated for each option in more detail how the forking effects that option. 
It is not very convenient, if you have to read several documentations, before you can savely use an option in konsole or any other KDE program.
Comment 9 Jekyll Wu 2011-07-30 15:04:35 UTC
IMHO, --nofork should be the default behaviour *when* konsole is invoked from terminal(stdin is a tty).

#217357 and #173697 are two good examples. If --nofork is the default behavior when invoked from terminal, those two problems simply do not exist.
Comment 10 Kurt Hindenburg 2011-07-31 19:17:47 UTC
Git commit 43ff8c48a7a0fd0086845f6aab8ecace51448732 by Kurt Hindenburg.
Committed on 31/07/2011 at 21:11.
Pushed by hindenburg into branch 'master'.

Add --nofork to the --help output.

--nofork is under --help-kde which is often overlooked by users.
Placing a comment under --help should cause less problems for users.
CCBUG: 217357
CCBUG: 262169
CCBUG: 173697

M  +1    -0    src/main.cpp

Comment 11 Jekyll Wu 2011-08-01 17:37:58 UTC
(In reply to comment #9)
> IMHO, --nofork should be the default behaviour *when* konsole is invoked from terminal(stdin is a tty).  

Another (less convincing) example: '--geometry' is currently useless unless '--nofork' is also used, see comment #23 of bug #155603. 

Although I agree #165355 on kdelibs is the root cause for the broken '--geometry', but if '--nofork' is the default behavior *when* invoked from terminal, konsole users will enjoy easier life.
Comment 12 Jekyll Wu 2011-10-23 07:00:06 UTC
Another problem caused by this foreground feature is users have difficuty setting some terminal editor(vim/nano/jed) as the external editor used by kmail. See comment #4 and #6 of bug #170867 for more info.