Coder Social home page Coder Social logo

Comments (11)

bruno- avatar bruno- commented on July 30, 2024

Hi, thanks for reporting the issue. This is a bug and I don't know how to handle it for now.

To clarify:

  1. this is the command you run: grunt development
  2. when saving tmux environment, this is saved: grunt ARCHFLAGS=-arch i386 -arch x86_64 Apple_PubSub_Socket_Render=/tmp/launch-Ou97Qf/Render

Weird env variables ARCHFLAGS and Apple_PubSub... are fine, we could remove them.
Unfortunately I don't see the word development in there, so that information is lost and can't be restored.

Thinking about other solutions to handle this, we could have a user option like this:

set -g @some-tmux-option "grunt->grunt development"

The above states: to restore grunt, the command to restore it is grunt development.
Would having that feature help?

from tmux-resurrect.

johnnncodes avatar johnnncodes commented on July 30, 2024

Hi @bruno- , yes I think having that feature would help. Anyway, I thought a feature that is almost similar to that already exists? I saw this in the docs:

set -g @resurrect-processes 'some_program "git log"'

and

set -g @resurrect-processes 'irb pry "~rails server" "~rails console"'

I also tried them btw but it didn't solved the issue. There was no output unlike the setting I used on my 1st comment - #32 (comment)

set -g @resurrect-processes '"grunt development"'

and

set -g @resurrect-processes '"~grunt development"'

from tmux-resurrect.

bruno- avatar bruno- commented on July 30, 2024

Yea, those features are similar, but not really what we need here.

Okay, I'll work on a feature that will hopefully help with this and then let you know.

from tmux-resurrect.

bruno- avatar bruno- commented on July 30, 2024

Hi, this feature should now be implemented.
So you can:

  • update the plugin (prefix + U if you have tpm installed)

  • set the following option (pls take care of quoting, single quotes outside, double quotes "inside"):

     set -g @resurrect-processes '"grunt->grunt development"'
    

Now, when grunt program is restored, the plugin will invoke grunt development command.

Let me know if it works!

from tmux-resurrect.

hoschi avatar hoschi commented on July 30, 2024

Have you tried save/restore the whole command instead of the process? Grunt is a bad example because it eats up the arguments. git log develop -20 gets restarted as git log instead. When you use the command you can restore the exact thing you started before. You get the command by ps --pid $pane_pid -o cmd. For grunt, someone can easily use a simple wrapper script, e.g.:

#! /bin/sh

grunt $*

from tmux-resurrect.

bruno- avatar bruno- commented on July 30, 2024

I just tested the command git log master -20 command and it got both saved and restored properly with all the arguments.

I'd love to improve the "process" for saving commands! Currently this is pretty isolated in this function here. I encourage you to submit a pull request that improves on that. Also feel free to ask related questions if there's any.

from tmux-resurrect.

johnnncodes avatar johnnncodes commented on July 30, 2024

@bruno- For some reason, it still doesn't work. Here's the contents of ~/.tmux/resurrect/last:

pane    0   0   :node   1   :*  0   :/Users/johnkevinmbasco/Vagrant/salt_basic/bitlock-angular  1   node    :grunt ARCHFLAGS=-arch i386 -arch x86_64 Apple_PubSub_Socket_Render=/tmp/launch-RoJZ9c/Render
window  0   0   1   :*  c8bd,156x37,0,0,0
state   0

Here's my tmux.conf:

# List of plugins
# Supports `github_username/repo` or full git URLs
set -g @tpm_plugins "              \
  tmux-plugins/tpm                 \
  tmux-plugins/tmux-sensible       \
  tmux-plugins/tmux-resurrect      \
"
set -g @resurrect-processes '"grunt->grunt development"'

# initializes TMUX plugin manager
run-shell ~/.tmux/plugins/tpm/tpm

setw -g mode-keys vi

bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"

set -g default-terminal "xterm"

from tmux-resurrect.

hoschi avatar hoschi commented on July 30, 2024

I just tested the command git log master -20 command and it got both saved and restored properly with all the arguments.

It doesn't work here :( I created a new issue #43

from tmux-resurrect.

bruno- avatar bruno- commented on July 30, 2024

@basco-johnkevin thanks for the patience with this.
Your .tmux.conf looks fine.
I tested restoring the state with the content of ~/.tmux/resurrect/last you provided and grunt also wasn't restoring for me!

After a while, I realized what's the problem:

  • when you kill tmux server and start it again, tmux opens session 0 with window 0 by default
  • now when you try to restore saved environment, tmux-restore will not restore session 0 and window 0 because it is already created! It also won't restore programs in that window - and this is why 'grunt' is not restored.

The above is actually considered to be a feature that makes tmux-resurrect idempotent. You can hit "tmux restore key" multiple times in the same tmux session, but the restore will happen only the first time.

Here are the steps to solve the problem and test if grunt is restoring properly:

  • run grunt program in any pane except in 'session 0/window 0'
  • save tmux environment
  • kill tmux
  • start tmux and restore the last environment

Hopefully it works for you now!

from tmux-resurrect.

bruno- avatar bruno- commented on July 30, 2024

Any updates on this @basco-johnkevin ?
It should work now!

from tmux-resurrect.

bruno- avatar bruno- commented on July 30, 2024

Hey guys, I'm doing a small issues cleanup. This feature seems to work now, please reopen or report again if you find any issues.

from tmux-resurrect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.