Dear Simon,
  Thank you very much for your quick and comprehensive explanations. (Could be a manpage by itself!)

Indeed, I'm scripting some tasks needing a terminal in an agnostic way. So, 'x-terminal-emulator -e ...' is the best way for me.

I am grateful for your guidance.

Best regards,
Christophe

Le 27/06/2023 à 15:13, Simon McVittie a écrit :
On Tue, 27 Jun 2023 at 14:11:35 +0200, Christophe Lohr wrote:
   The code of this wrapper make several rearrangements to convert '-e' and '-x'
options into the '--' syntax, but it seems to not support itself the '--'
syntax on its command line. Isn't it?
Is this an oversight or I am wrong?
May I suggest adding support for "--"?
Please could you clarify why it would be useful for gnome-terminal.wrapper
to support the "--" syntax?

The only purpose of gnome-terminal.wrapper is to implement Debian's
x-terminal-emulator interface as defined in
<https://www.debian.org/doc/debian-policy/ch-customized-programs.html#packages-providing-a-terminal-emulator>,
which is a subset of xterm's command-line interface and therefore uses
"-e" to prefix a command to run. xterm does not support the GNU-style "--"
and there is no guarantee that an implementation of x-terminal-emulator
will support it either, so accepting it in gnome-terminal.wrapper
would just make it a bit more likely for people to write calls like
"x-terminal-emulator -- less /etc/hosts" which will actually only work
for a few specific terminal emulators.

If you're writing code that runs gnome-terminal (specifically) as a
subprocess, please use the gnome-terminal command and its preferred
"--" syntax.  There is no need to use the wrapper in this case, and in
fact it would be counterproductive to do so: all it does is to slow down
startup a little bit, and make some features unavailable.

If you're writing code that runs the generic x-terminal-emulator command
as a subprocess, then you will have to use the "-e" syntax, otherwise it
won't work correctly with xterm (and probably many other terminal emulators).

If you're writing code that supports multiple specific commands as ways
to run a command in a terminal, then it needs to "just know" whether
each one expects "-e", "-x", "--", or no argument at all. The table of
known terminals in
<https://gitlab.gnome.org/GNOME/glib/-/blob/2.76.3/gio/gdesktopappinfo.c#L2698>
is an example of this technique. Everyone involved recognises that this
is not a pleasant interface, but that's the price we pay for portability.

     smcv

Reply via email to