-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respawning panes and remain-on-exit #139
Comments
What version of tmux and tmuxp is this? What shell (bash, zsh, tcsh, etc.)? I am not familiar with pane respawning. I am interested in your use case however, since it'd help me get familiarized so I can be of more help. Can you get into more specifics on why you're using respawn-pane/trying to rerun commands again via yaml? |
Often I use tmux to wrap multiple running components of a project, sometimes I will need to restart ones of those components. For example, if I'm using a web server with a filewatcher and something breaks the watcher; I want to adjust the code that killed the watcher and restart just that pane within my tmux session. Here is a test case to demonstrate this behavior: Setupstart.sh
start.yaml
test-script.sh
.tmux.conf (add hotkey to reload pane)
Run
Expected behavior (bash):
Unexpected behavior (yaml):
TestUse the respawn hotkey on the pane that contains the ResultExpected: The script (test-script.sh) reloads (you can see the date change). Preview of a pane that's died without closing: Unexpected (using tmuxp yaml): The script (test-script.sh) runs once; I cannot The output is:
I could repeat the command by pressing 'up' to activate the history, but I would like to know if there is a way to respawn-pane the tmux way and re-execute the command it spawned with. If I type "exit" in the pane, I will see "Pane is dead," however "respawn pane" gives me only an empty terminal. Software DetailsI'm using: tmux 1.8-5 Please let me know if you'd like any more information. Thanks. |
Is tmuxp preventing this? I'm trying to determine if this is a general tmux question, a bug or a question of how to approach this problem with tmuxp. I haven't used the respawn behavior before.
What file watcher are you using? I haven't add this exact itch to scratch, but for similar things, I'll wrap it in |
I think that this stackexchage post covers what is known on this topic. |
@tony my apologies, I missed your previous message notification. To clarify, this is a tmux behavior that I would like to be able to set in a tmuxp YAML definition. I would like to be able to set a session, window or pane to "remain-on-exit". In my test case above, I was intending to show the result of a pane remaining open with an exited script. The pane could be dead for any number of reasons, but the part I'm interested in, is the ability to "respawn-pane", e.g. re-run the command it launched with. Below are excerpts from the man page that describe the behaviors. The link above, from @kmactavish, may offer further clarity.
Hope this helps, thanks. |
I have updated my test case with more information. |
@z The thing is I just don't use this part of tmux. I just used the yaml file from your original post #139 (comment) tmuxp is setting ❯ tmux show-window-options
automatic-rename off
remain-on-exit on Are you correctly seeing the window option when you load a tmuxp config? |
This issue has been automatically marked as stale because it has not had This bot is used to handle issues where the issue hasn't been discussed or |
It seems this bug was never fixed. Is there any chance for a second look into this? Or is there a workaround by now? |
Just to add some information to this topic. The problem stems from tmuxp starting a shell in windows by default and then sending any further applications to be started via send-keys. This way, when you use the respawn-pane functionality, only the shell gets restarted. |
@jerri I removed the stale from this and add Pinned so stale bot doesn't close this again We are open to PRs in a case like this (including a testcase) |
I guess the easist approach to this would be to add a parameter "shell" to the panes level. This way you could do a lot of cool stuff. E.g. you could for just one pane set python as the shell and then all the stuff added via shell-commands is going to be added to that environment. I checked out the code, but haven't find my way around it yet. But I think I would like to try to add this to the system. |
I created a first implementation here https://github.com/jerri/tmuxp/tree/issue-139 . A demo file would look like this:
I also fixed a bug with this code, I believe, because right now Next I would like to create a test for this addition. But I am not quite sure I fully understand, how the test system works and how you are testing against real tmux. Maybe someone can help me here. On top, unfortunately, the tests don't seem to run through on my mac. The tests in On top, is this change actually relevant for the project? I found, that I can workaround my current problems using |
@jerri I reopened this issue (sorry it was closed)
I'm not quite sure - but it's good we're having the conversation. Can you make a pull request of this branch as well? Can you explain the use case for remain-on-exit? Personally, I've never used it. That's my biggest difficulty at the moment.
Hm. This is a good time for me to improve our developer documentation. How familiar are you with python? pip? poetry? py.test? How far along does this get you? https://tmuxp.git-pull.com/developing.html
That should automatically have you an environment with tests that automatically re-run when files are edited. |
Thanks for the info. I will check it out this evening. Regarding the use case for remain-on-exit. I use tmuxp to start a standard session with relevant tools I use. E.g. my mail client (neomutt) or an irc client (irssi). I want this tools to be always at the same place. So, when I have to restart them, I just quite them, as usual. The pane doesn't vanish and I can just So, right now as a workaround I just use Apart from that I like the idea of having the capabilities to specify the shell per pane (like in the example provided above). |
I wish I had a recording of what that workflow would look like. I'm slowly getting more familiar with this issue and how workspace_bulider could be getting in the way. The reason why is I have the habit of thinking of restoring tmux in terms of a whole session, tmuxp/tmuxinator/teamocil is about restoring the whole session - it just does it for the whole session rather than a pane. In regards to your branch, please do PR it, let's see how our test suite handles it. |
Sorry for delay. Didn't have a lot of time lately. I will clean up my branch and will do a PR. I will see if I can make a screencast to showcase how I am usually working. Might help to make it more easily understandable. I will also try to add a meaningful example to the examples documentation. |
Using YAML, is there a way to respawn a pane and run the commands for that pane again?
I've tried:
I was expecting when I sent:
respawn-pane -k
for "ls
" to reload. This is not the case.Thanks.
The text was updated successfully, but these errors were encountered: