contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.31k stars 100 forks source link

How to remove "Shell terminated too quickly. The window will not be closed automatically." #1460

Closed opossalite closed 4 months ago

opossalite commented 4 months ago

I'm wondering about behavior I'm having with Contour which doesn't happen in other terminals. When I open a new terminal and quickly type "exit", I get the message from the title. I will provide a screenshot here as well. How do I prevent this message from popping up? The terminal doesn't close until another key is pressed or I kill the window. Expected behavior is to exit as soon as the command is inputted, I don't get this message with alacritty, kitty, or wezterm. I'm sure this isn't a bug, but I don't see any reference to this online.

image

System info: NixOS 23.11

Yaraslaut commented 4 months ago

You can see some info from contour help page :

            [early-exit-threshold UINT]    If the spawned process exits earlier than the given threshold seconds, an error message will be printed and the window not closed immediately.
                                           [default: 6]

This message you see happens only if you try to exit immediately after opening the terminal, so running with contour early-exit-threshold 0 must solve the problem, also, what version of contour are you using?

opossalite commented 4 months ago

Seems to be 0.3.12.262. Adding the early-exit-threshold argument fixes it, thank you. I'm not sure why this threshold exists though, what is the logic behind it being set at 6 seconds?

Yaraslaut commented 4 months ago

Seems to be 0.3.12.262. Adding the early-exit-threshold argument fixes it, thank you. I'm not sure why this threshold exists though, what is the logic behind it being set at 6 seconds?

@christianparpart might tell some story about it, i think that it was introduced on the early stage of development for test purposes.

christianparpart commented 4 months ago

Hi @TheTerrior. This was added because it MAY be that whatever application you spawn as main program in your terminal (usually the shell), can exit right at the startup. This leads to the user believing that the terminal is not working, because you don't see that it even was there, and even if you noticed that, the window would be closed too quickly to actually read any potential diagnostic error message, telling you, why the program terminated too quickly.

Contour since then added a guard that prevents too quick terminating apps to also terminate the terminal in order to allow the user to review the screen before finally closing it.

However, on our CI side, we must expect some tests to terminate quickly, so early-exit-threshold SECONDS was added to to be able to set it to 0, especially since in test-automation, there'll be no user to trigger input of any form, just to finish the integration-test.

Does this clarify its existence for you? Is there anything that you think might help improving user experience?