Skip to content
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

[Bug] watch command resurrects without '-characters. #60

Open
absorber opened this issue Dec 9, 2014 · 10 comments
Open

[Bug] watch command resurrects without '-characters. #60

absorber opened this issue Dec 9, 2014 · 10 comments

Comments

@absorber
Copy link

absorber commented Dec 9, 2014

First of all, thank you for making this really awesome tool that I've been waiting for a long time now!
Also, I'm pretty new on Git(Hub) and as such I'm not sure how to report new issues (or feature requests for that matter). If you have a comment then please let me know how I could do things better next time :)

On to the situation:

After I've saved the session (only 1) and I tried to resurrect it, I found that in one of the panes the command watch -n1 -d 'free -m; df -h' was turned into watch -n1 -d free -m; df -h upon resurrection.

Also I've found that the htop pane had more space than previously, but I suppose that's material for another bug report?

Here's the ~/.tmux/resurrect/last and my .tmux.conf

@bruno-
Copy link
Member

bruno- commented Jan 2, 2015

If you have a comment then please let me know how I could do things better next time :)

Thank you for taking the time to report the issue. You've done all good 👍 . I especially appreciate that you included the proper files at the end of your post.

I've looked into this issue.. and I too can reproduce the bug where the quotes are missing.

Unfortunately, I don't know what can be done about this... I've played with both ps and pgrep programs that we use to get process' argument list. And it's the quote-free output that we get from both ps and pgrep. Given that those tools "loose" the quoting, I'm not sure what can be done so they are restored...

I'll place the proper labels at this issue, but unfortunately I don't know if we'll ever have the solution.

@bruno-
Copy link
Member

bruno- commented Jan 2, 2015

Oh, I forgot to add.. even if this issue was solved, I'm sure there would be some other command line construct "discovered" after this one that could not be restored (pipes, redirects etc come to mind).

So, I'd say the question is not "how to restore every possible command line construct?", but "where is the line of what can be restored?". Even if our command restore capabilities are pretty limited, that's probably okay.

This plugin was never really intended for restoring all commands. That could even be dangerous. Instead, a user should pick a couple commands that are important in his workflow and explicitly enable them via set -g @resurrect-processes.. and that's it. Non standard and complex stuff should really be explicitly typed and executed again really.

@absorber also I've opened #65 for the second issue you brought up.

@absorber
Copy link
Author

Oh, I forgot to add.. even if this issue was solved, I'm sure there would be some other command line construct "discovered" after this one that could not be restored (pipes, redirects etc come to mind).

Hmm I see. So is this something which can be fixed / implemented / taken care of in the tmux codebase itself? If not, I hope the tmux team considers doing so in the future. Tmux resurrect is a really cool and much needed feature IMO.

Meanwhile, is there a list of supported commands (and their constructs) which can be restored? If not, perhaps we can work on documenting them in the wiki?

@bruno-
Copy link
Member

bruno- commented Jan 21, 2015

So is this something which can be fixed / implemented / taken care of in the tmux codebase itself?

Hmm.. I somehow doubt it. Vanilla tmux does have support for detecting running programs via pane_current_command (you can look it up in the tmux manpages), but it's pretty basic. You can always open an issue to tmux core team if you want to bring their attention to this.

Meanwhile, is there a list of supported commands (and their constructs) which can be restored?

We have this in the configuration section in the readme.

@wqtty
Copy link

wqtty commented Dec 17, 2015

Does this have anything to do with bash itself?
IMHO, bash would strip the quotes before it executes the commands.....

@donat-b
Copy link
Contributor

donat-b commented Sep 27, 2017

I have found a way to restore command arguments in a way that doesn't break with quotation marks.
But I had to encode the contents of proc/cmdline as escaping it during save didn't work.
Here's my patch: https://github.com/tmux-plugins/tmux-resurrect/compare/master...donat-b:cmdline?expand=1
I can make a PR unless someone has a better idea how to make this work.

@bruno-
Copy link
Member

bruno- commented Sep 28, 2017

From what I see that uses /proc filesystem.. so it wouldn't work on osx.. but it could be added as a "save strategy".

@rummik
Copy link
Contributor

rummik commented Dec 28, 2018

I'm seeing this with Neovim on NixOS (Linux) due to wrappings. Going to try @donat-b's changes, since they're in the same vein as what I was looking at doing.

@rummik
Copy link
Contributor

rummik commented Dec 28, 2018

Looks like it needed a small adjustment to disable wrapping output from base64. Submitting a PR

@unphased
Copy link

unphased commented Jun 11, 2021

pane_current_command

For what it's worth.. I do put pane_current_command on my pane title bars and so at a glance I can confirm that it does retain both backslash-escaped spaces and single and double quotes, which if this method is used (rather than ps or /proc/{PID}/cmdline which definitely does not keep them) for resurrection it seems like it'd be an improvement to how this works now.

Like, it's pretty bad, don't you think, that resurrect simply can't handle any reasonable form of tail -f log\ file\ with\ space.log command?

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

No branches or pull requests

6 participants