Open absorber opened 9 years ago
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 :+1: . 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.
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.
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?
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.
Does this have anything to do with bash itself? IMHO, bash would strip the quotes before it executes the commands.....
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.
From what I see that uses /proc
filesystem.. so it wouldn't work on osx.. but it could be added as a "save strategy".
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.
Looks like it needed a small adjustment to disable wrapping output from base64
. Submitting a PR
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?
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 intowatch -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