Add a "Restart command on failure" option to the profile command settings
Submitted by Ryan S
Link to original bug (#784328)
Description
Created attachment 354676 Relevant UI
When specifying a command to run instead of my normal shell in a terminal, I am presented with the following 3 options for how the terminal should behave if the program exits:
"Exit the terminal" "Restart the command" "Hold the terminal open"
I propose you add a mechanism to check the exit status of the program and restart it if that status is nonzero. If it is zero, it should fall back on the behavior specified in the dropdown.
Why do I want this?
Say I have a profile which automatically invokes SSH to connect to a remote machine instead of opening a local shell.
- If I set it to close the terminal when the process exits, closing tabs by ^D works as expected, but if my internet connectivity hiccups, my whole terminal will unconditionally exit without asking, which strikes me as rude.
- If I set it to restart the program automatically, my SSH sessions will reconnect after an internet hiccup, but attempting to close the tab with ^D will result in the connection closing and then merrily re-opening immediately.
Ideally, what would happen here is my connections would re-open if closed by force somehow (in which case SSH would return non-zero), but if terminated through ordinary program exit, they would be allowed to exit gracefully.