custom command causing pane to be closed after subprocess stops

Bug #1437637 reported by no
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Terminator
New
Wishlist
Unassigned

Bug Description

If a terminator gets started with a layout that is split into more than one pane, and if one of those panes runs a task on startup from the custom command, something like a phyton server, there seems to be no way to cancel that task without closing the pane.

so say i run terminator -l foobar which spawns a new terminator window with 2 panes, the bottom one running a phyton server. now something happens and i want to restart the server. i cancel it with ctrl + c and the pane closes. in order to restart it i have to first recreate the pane.

What i want is some way to leave a pane open even if its subprocess cancels.

Usually theres the "; bash" "; $SHELL" command, but that only seems to work if the previous process returns without any user interaction.

I've done alot of research on this issue but could not find any solution, if there already is one, please tell me.
Otherwise i'd propose a "leave open" checkbox on each pane inside the layouts menu that makes sure panes dont close unless the user closes it with ctrl + w.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Have you tried the following?

Create a custom profile (like your normal one), but with the following modification:
On the profiles "Command" tab, change the "When command exits" to either "Restart the command" or "Hold the terminal open" depending on what you want to happen.
Then edit your layout with the custom command to use this profile.

I haven't tried this, but I think it will do what you want.

Revision history for this message
no (stefan-k-90) wrote :

Sadly no, "Hold the terminal open" holds the pane open, but it doesn't return a shell, so i cannot enter any commands.

The "Restart the command" is very useful in many cases, but sometimes i want to change a task inside a pane (example: switching grunt tasks), but i can't do that easily because i have to first close the pane, then open a new one in its place to start the new task.

Also, to me the "restart the command" option would make more sense on the layout itself instead of under profiles, because i have some panes i want to restart, and some to return a shell. The way it is right now i'd have to create 2 profiles with the exact same settings, one with the "restart the command" and the other with the "Hold the terminal open" option.

Revision history for this message
no (stefan-k-90) wrote :

Since i needed this, I investigated further. Heres the solution i came up with.
Set the Comman option to "restart the command". If you want a pane to not restart but stay open on ctrl + c do the following:
Have the layout pane custom command reference a script. in that script add

#!/bin/bash
trap _exit INT TERM

function _exit() {
  $SHELL;
}

to the top.

This will return a shell on Ctrl + C. I think it should still be implemented into terminator, but atleast i have a workaround for now.
Thanks for your help.

Changed in terminator:
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.