Score:1

How can I move the Gnome Terminal message "the child process exited ..."?

cn flag

I just installed an IDE extension that runs the current program in a terminal, and I have Gnome Terminal set to stay open when the command exits, but when that happens, the first two lines are covered up by the message "The child process exited normally with status 0". How could I move it?

I believe this is possible by editing a Gnome stylesheet, but I'm not sure where to start.

Example

Here's a simple Python script:

#!/usr/bin/env python3

x = input('Enter something: ')
print('You entered:', x)

I run it and type something:

screenshot showing "Enter something: foobar"

(My system is in French.)

Then as soon as I press Enter, the script exits and the message pops up, blocking the output:

screenshot showing output blocked by message

I'd rather have the message somewhere else, like at the bottom for example. Here's a mockup:

mockup showing output unblocked by putting the message at the bottom

You can reproduce the issue by saving the script as tmp.py then running gnome-terminal -- python3 tmp.py. And make sure you have Gnome Terminal set up correctly: go to EditPreferencesCommandWhen the command exits and select Hold the terminal open.

Possible workarounds

  • Make the program hold the terminal open, e.g. input('Press Enter to finish...'). -- I'd rather not have to put that on everything I write.
  • Use an integrated IDE terminal. -- I haven't found a good one yet, and I prefer using the native terminal for most things.
  • Relaunch the program after it exits. -- If it has any side-effects, that might be bad, for example if it reads and writes any files.

Related

Hi-Angel avatar
es flag
By following your steps I can not reproduce this on `GNOME Terminal 3.40.3`. I.e. I execute your script inside Gnome Terminal, then I enter `foobar` into the prompt, and press enter, I see no pop ups from the terminal. I presume it may have been fixed in more recent versions of Gnome Terminal.
wjandrea avatar
cn flag
@Hi-Angel Thanks for the lead! I'm using GNOME Terminal 3.28.2. But where do you see the exit code come up? Or is it missing?
Hi-Angel avatar
es flag
I don't see exit code anywhere. Here's a screenshot of what I see: https://i.imgur.com/LPR4AYa.png
wjandrea avatar
cn flag
@Hi-Angel Oh, you're launching it from a shell! You'll need to use `exec ./test.py` to reproduce the issue. The extension I'm using does the equivalent of `gnome-terminal -- ./test.py`, which launches a new terminal.
Hi-Angel avatar
es flag
When I use `exec test.py`, Gnome Terminal simply quits right after I type into the prompt "foobar". So, well, still no pop up, although I guess that's not what you wanted ☺ I think you may have better luck getting correct answers if you add to your post the exact steps to reproduce, preferably as minimal as possible.
wjandrea avatar
cn flag
@Hi-Angel You need to have Gnome Terminal set to stay open when the command exits. Yeah, I should add the steps.
vanadium avatar
cn flag
Upvote because the question is very well documented, but I would take a different approach, i.e. start the application in a terminal that is already open. It would likely take a feature request to have the developpers make this message not covering existing terminal output or providing an option to disable the message. Alternatively, find another terminal emulator that performs more like you would wish.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.