On 2019-07-18 10:29, John Crawley wrote:
Hi tomas and Thomas, thanks for your input.
I think I have a basic idea of what exec does.
However, try running in a terminal:
echo $$
exec <someterminal>
#Then, in the new terminal:
echo $$
The two PIDs are different! (or were here)
On 2019-07-17 17:37, Thomas Schmitt wrote:
John Crawley wrote:
In Buster, the launching dash shell dies *immediately* and the bash
prompt returns, even while the new window is still open.
tomas wrote:
that most probably is due to a change
in behaviour of "x-terminal-emulator".
My suspicion too. If the x-terminal-emulator puts itself into background,
then the starting terminal ends immediately.
The Debian alternative system is just a series of symlinks.
/usr/bin/x-terminal-emulator points to
/etc/alternatives/x-terminal-emulator which in turn points to (on my
system) /usr/bin/urxvt.
It's hard to imagine a stretch>buster change in behaviour, really.
What happens if you run
x-terminal-emulator
without "exec". Does the shell prompt come back immediately ?
No. Not on Stretch. x-terminal-emulator, or a specific terminal call, in
every case the prompt waits till the called window is closed.
---
But... on Buster it depends on exactly what terminal it's currently
pointing to. I've tried a few that were on my test system and:
gnome-terminal or gnome-terminal.wrapper and lxterminal both return the
prompt immediately. (*.wrapper scripts are for x-terminal-emulator
compatibility, but don't seem to affect this issue.)
urxvt, xterm, mate-terminal{,.wrapper}, xfce4-terminal{,.wrapper} and
terminator all hold the prompt till the window is closed.
---
On my test system, at the time, x-terminal-emulator pointed to
lxterminal, so it looks as if "exec" has nothing to do with this.
I'll have to do a bit of googling about why lxterminal and
gnome-terminal's behaviour has changed like this, though. Unless you
folks have any ideas?
I'd like my scripts to work the same regardless of what terminal a user
has set as x-terminal-emulator.
It seems gnome-terminal has a complicated server-client setup, but the
immediate prompt return can be avoided with 'gnome-terminal --wait':
https://bugzilla.gnome.org/show_bug.cgi?id=707899
Lxterminal (which I was more interested in) says "all instances of the
terminal are sharing a single process" which explains that, but it can
be bypassed with '--no-remote'.
So a check if x-terminal-emulator points to lxterminal and if so adding
'--no-remote' should cover my needs. Sorry for the noise.
--
John