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

resurrect does not restore #98

Closed
simonsmith opened this Issue Aug 19, 2015 · 13 comments

Comments

Projects
None yet
5 participants
@simonsmith

simonsmith commented Aug 19, 2015

Hey,

Hoping you can help, as I'd love to use this plugin. I seem to be able to save a session (success message and written to last) but when I try to restore it either exits tmux with no sessions or says it has restored but with nothing there. Here is a video of the latter issue if it helps - http://cl.ly/cGwC

Here is my .tmux.conf - https://github.com/simonsmith/dotfiles/blob/master/.tmux.conf

Contents of my last after the video:

pane    testing 1   :zsh    1   :*  1   :/Users/simonsmith  0   vim :-zsh
pane    testing 1   :zsh    1   :*  2   :/Users/simonsmith  1   zsh :-zsh
window  testing 1   1   :*  3859,126x42,0,0{63x42,0,0,0,62x42,64,0,1}
state   testing 

I'm using zsh 5.0.5 with oh-my-zsh on iTerm2 - Build 2.9.20150626

I've tried using it with and without continuum and that makes no difference. I would be grateful for any help.

Thank you

@waynew

This comment has been minimized.

waynew commented Aug 19, 2015

I'm getting some similar behavior - tmux restore has worked flawlessly for the last... almost year that I've been using it?

I've tried pointing last to several different resurrect files, and without fail it only loads 3 of my sessions and parts of the windows (I have several more than that in most of my resurrect states).

Is there any way to get some logging out to a file so I/we could help figure out what's happening here?

@bruno- bruno- added the bug label Aug 19, 2015

@bruno-

This comment has been minimized.

Member

bruno- commented Aug 19, 2015

@simonsmith, thanks for the detailed report and the effort with the video!

I think the problem might be with the value of default-command tmux option from tmux.conf combined with the @resurrect-capture-pane-contents 'on' option from tmux-resurrect.

I was able to reproduce the issue by setting those options to be the same as what you're running. In my case tmux quit after the restore.

Can you try one of these options:

  • simplify default-command value, eg make it: set -g default-command "reattach-to-user-namespace -l $SHELL" (it's important to remove && and || shell operators) and then try restoring.
  • if the above doesn't work, try commenting out set -g @resurrect-capture-pane-contents 'on' and see if restore behaves better

I think the first thing of simplifying the default-command should work. If that's the issue here, we should probably document it.

@bruno-

This comment has been minimized.

Member

bruno- commented Aug 19, 2015

@waynew,
does anything from the above comment ring a bell?

Unfortunately, I don't know of a way to enable logging..
For starters, I think the best approach is to just provide a link to the content of the last file + tmux.conf.

@simonsmith

This comment has been minimized.

simonsmith commented Aug 19, 2015

@bruno- Your first suggestion of simplifying default-command works a treat. Thanks so much for the tip there.

I seem to be up and running as expected!

@simonsmith

This comment has been minimized.

simonsmith commented Aug 19, 2015

@bruno- One stumbling block for me is the restoring of things like grunt or gulp.

I understand that I can use the following to help me restore a gulp task:

set -g @resurrect-processes '"~gulp->gulp watch"'

However I'm not sure what to do in the situation where I might have multiple gulp tasks that need to restore, like gulp server in another window. Just using "~gulp" doesn't seem to to help as it tries to run just the gulp command.

Any thoughts?

@bruno-

This comment has been minimized.

Member

bruno- commented Aug 20, 2015

Good to hear things work now.

About restoring programs: it seems you understand the tilde ~ and the arrow -> usage. We don't have "tools" other than those..

The general strategy with the processes is:

  • you manually set up all the programs in tmux
  • save tmux env
  • open ~/.tmux/resurrect/last and try to see how are your programs saved (you should be able to figure this out). For example gulp might have full process name eg /some/long/path/to/gulp watch
  • after that, it's just a matter of playing with tilde and arrows to get what you need

I am surprised that just "~gulp" (no arrow) didn't work properly. Say you had these 2 different processes saved:

  • pane 1: /some/long/path/to/gulp watch
  • pane 2: /another/foo/bar/gulp server

Using just "~gulp" it should restore full (long) process names for each pane, *not* just gulp. So, for pane 1 /some/long/path/to/gulp watch should get restored and equivalently for pane 2.

Link up your last file if you still have troubles.

@simonsmith

This comment has been minimized.

simonsmith commented Aug 20, 2015

Here is my last file when running two different gulp tasks (gulp server & gulp watch)

pane    testing-gulp    1   :node   1   :*  1   :/Users/simonsmith/Sites/bbc/bbcthree-web/client    0   node    :gulp  
pane    testing-gulp    1   :node   1   :*  2   :/Users/simonsmith/Sites/bbc/bbc-cards  1   node    :gulp  
window  testing-gulp    1   1   :*  f6ac,158x90,0,0{79x90,0,0,0,78x90,80,0,1}
state   testing-gulp    

It seems that in both instances it only saves the gulp part of my command, not the task I passed to it. When running restore tmux runs gulp in each pane

@bruno-

This comment has been minimized.

Member

bruno- commented Aug 20, 2015

It seems you're right, only gulp is saved.

I remembered there's another option to try:

set -g @resurrect-save-command-strategy 'pgrep'

It will use pgrep program to try to get process name and save it in the last file. By default more portable ps is used.

Not sure what to do if that doesn't work. Maybe have "~gulp->./start-gulp" where start-gulp is a script in the current dir that just starts proper gulp command?

Is it an option to open an issue on gulp project and try to see if they can make a tweak so their program shows more info in ps command output.

@bruno-

This comment has been minimized.

Member

bruno- commented Aug 21, 2015

Restoring pane contents feature now documents a known compatibility issue with certain values of default-command tmux option. Link to doc.

@simonsmith

This comment has been minimized.

simonsmith commented Sep 2, 2015

Just to follow up here, I've decided to leave things like gulp to be reactivated manually as the requirements differ so much between all the projects I have. I still get all my windows and panes restored as expected now, which is ace.

Closing this now, thanks

@simonsmith simonsmith closed this Sep 2, 2015

@bruno-

This comment has been minimized.

Member

bruno- commented Sep 3, 2015

Thank you for the update.

@unhammer

This comment has been minimized.

unhammer commented Jan 20, 2016

Note: it's not just && and ||; it seems () might affect it too. I had exec -a "$(basename "$PWD")" /bin/bash as my default-command, had to put that in a file and give the file path instead.

@Hultner

This comment has been minimized.

Hultner commented Apr 28, 2017

I noticed the same thing as @unhammer
I had a ;in my default-command and couldn't restore. At first I didn't think of this bug as it does not document this problem. Maybe it should be documented for future advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment