gnome-terminal.wrapper doesn't wait until program finishes

Bug #666418 reported by Beni Cherniavsky
22
This bug affects 5 people
Affects Status Importance Assigned to Milestone
gnome-terminal (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Binary package hint: gnome-terminal

"gnome-terminal -e some_program"
usually (if another gnome-terminal is already running) returns immediately; most other terminal emulators (e.g. xterm) return only after the program finishes, which is much more convenient when opening programs in a terminal from scripts.
"gnome-terminal --disable-factory -e some_program"
does wait, which solves the issue - unless you're writing a portable script and use
"x-terminal-emulator -e some_program"
where you'll get different behavior depending on the alternative selected for x-terminal-emulator.
And you can't use "x-terminal-emulator --disable-factory -e some_program" because xterm etc. will barf on it.

IMHO, gnome-terminal itself should always wait for the command to return.
But defaulting to no-factory mode would lose all benefits for which the factory was created;
waiting for completion notification from the factory would solve it better but I have no idea if it's easy to implement.

An easier solution is to always add --disable-factory in gnome-terminal.wrapper.
This would keep the behavior of "gnome-terminal" but unify the behavior of "x-terminal-emulator".

Revision history for this message
Pedro Villavicencio (pedro) wrote :

Thanks for the report, it has been some time without any response or feedback in this bug report and we are wondering if this is still an issue for you with the latest release of Ubuntu the Natty Narwhal, May you please test with that version and comment back if you're still having or not the issue? Please have a look at http://www.ubuntu.com/download to know how to install that version.Thanks in advance and sorry for the late response.

Changed in gnome-terminal (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Beni Cherniavsky (cben) wrote :

Yes, the situation is the same on natty.

Googling more, it seems there is a similar situation with konsole.
So to portably launch a command in a terminal and wait for it to finish, one currently needs to special-case each terminal, like http://hg.netbeans.org/cnd-main/file/tip/cnd.debugger.gdb/src/org/netbeans/modules/cnd/debugger/gdb/proxy/ExternalTerminal.java#l209

I didn't find a proper definition of how x-terminal-emulator SHOULD behave, but:
- http://bugs.debian.org/481123 says "Without such an option, urxvtc cannot be an x-terminal-emulator alternative, because x-terminal-emulator is expected not to return before the terminal window is closed."
- It's clearly intended to be xterm-compatible, and "xterm -e command" waits.
- If it waits, caller has freedom to background it; if it doesn't caller has *no way* to wait for completion of command.

Changed in gnome-terminal (Ubuntu):
status: Incomplete → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnome-terminal (Ubuntu):
status: New → Confirmed
Revision history for this message
Victor Engmark (victor-engmark) wrote :

This is what caused bug #799627 - "Race condition in mailto-mutt".

Revision history for this message
Victor Engmark (victor-engmark) wrote :
Revision history for this message
Beni Cherniavsky (cben) wrote :

Still happens on Precise with gnome-terminal 3.4.1.1.

According to https://bugzilla.gnome.org/show_bug.cgi?id=664730 fixed in upstream.

Revision history for this message
lediableboiteux (lediableboiteux) wrote :

Still happens in yakkety.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.