Open codisms opened 8 years ago
In adding debug statements to restore.sh, it seems like it's picking up that the processes should be restored, but the tmux send-keys
command isn't working.
Interesting, we never had this issue before.
Is tmux send-keys
not working at all? What happens if you manually execute tmux send-keys "foo bar"
in the terminal?
Works just fine.
[~] » tmux send-keys "wee"
wee# [~] » wee
I found a fix. If I specify the entire session/window/pane on the command line, like so: tmux send-keys -t "${session_name}:${window_number}.$pane_index"
I have similar problem here under zsh. I tried "htop" and "vim" on reboot, yet neither command is restored. The operating system is arch linux, and default-command is "".
I am also having the same issue ssh process is not starting.
Probably I encountered the same problem.
prefix C-r
switches to created pane but sends all the commands to the executing one (i.e. the pane, from which I've sent prefix C-r
).
Explicitly specifying -t $session_name:$window_number.pane_index
works just fine.
Here's tmux show -g
output.
I'm using tmux 2.3 from archlinux repositories.
Shell is zsh.
Is it ever supposed to work? pty1:
$ tmux new -s mains -n mainw
pty2:
$ cat > test.sh <<EOF
tmux switch-client -t mains:mainw
tmux select-pane -t 0
tmux send-keys sup
EOF
$ chmod +x test.sh
$ tmux new -s runner
pty3:
$ tmux new -t runner
$ ./test.sh
For me, the results are:
mains
, just like if i started tmux with new -t mains
runner
and text "sup"
is typedApparently, tmux-resurrect
expects that "sup"
will be in pty1
Hi all, I have same issue as described here. Looks that main problem is that we're using ZSH against Bash. My windows and panes have been restored too, but no Vim session, htop, man and ranger (I put it to my tmux.conf) tmux_tom.zip
Is there any solution for this? Thx for reply.
Tom
EDIT: When I've changed default shell to BASH from ZSH, it works without problem (expect ranger), so Vim, man, htop have been restored.
I have the same issue. Is there a solution?
I have the same issue as well. Any updates for zsh users?
Edit: I can confirm @codisms' temporary fix works for now.
Hi have the same issue with arch/zsh.
@christarazi @codisms how do you use tmux send-keys -t "${session_name}:${window_number}.$pane_index"
?
Do you actually type that to run tmux? Or after tmux is running? Do you rplace ${...} with values?
OK, I found out that by updating tmux-resurrect/scripts/process_restore_helpers.sh
with tmux send-keys -t "${session_name}:${window_number}.$pane_index"
like below, it works again.
Should I do a pull request?
10 restore_pane_process() {
11 local pane_full_command="$1"
12 local session_name="$2"
13 local window_number="$3"
14 local pane_index="$4"
15 local dir="$5"
16 if _process_should_be_restored "$pane_full_command" "$session_name" "$window_number" "$pane_index"; then
17 tmux switch-client -t "${session_name}:${window_number}"
18 tmux select-pane -t "$pane_index"
19 local pane_id="${session_name}:${window_number}.$pane_index"
20
21 local inline_strategy="$(_get_inline_strategy "$pane_full_command")" # might not be defined
22 if [ -n "$inline_strategy" ]; then
23 # inline strategy exists
24 tmux send-keys -t "$pane_id" "$inline_strategy" "C-m"
25 elif _strategy_exists "$pane_full_command"; then
26 local strategy_file="$(_get_strategy_file "$pane_full_command")"
27 local strategy_command="$($strategy_file "$pane_full_command" "$dir")"
28 tmux send-keys -t "$pane_id" "$strategy_command" "C-m"
29 else
30 # just invoke the command
31 tmux send-keys -t "$pane_id" "$pane_full_command" "C-m"
32 fi
33 fi
34 }
@emmanuelgeoffray yes, I thin a PR can be useful. I'm interested by your work.
Thanks !
hey @GCorbel !
After more tests, I have an inutition that the issue comes from session with no names, just numbers.
Can you try tthis?
start a new session with a name: tmux new -s mysession
open a few panes, vim some files,
close all other sessions prefix
:kill-session -a
save this session : prefix
C-s
kill session: prefix
:kill-session
run tmux again tmux
restore session: prefix
C-r
Does it work?
@emmanuelgeoffray it doesn't works. Vim is not restored properly an all program are stooped.
Good news, your code seems to work. Thanks for that.
@emmanuelgeoffray A pull request doesn't seem necessary, #180 already exists and fixes the problem. Not sure what the maintainers think of it.
Great! Thanks for pointing that out @christarazi
I was having this problem, too, and the change that @emmanuelgeoffray shared above (and that mk12 implemented in #180) fixed it for me.
When doing
prefix C-r
, the windows and panes open correctly, and pane contents are there, but the commands aren't restarted, even though I spelled out that I want "tail" in the@resurrect-processes
option.I use zsh as my shell, if that matters.
.tmux.conf (removed key bindings):
Latest stored state:
default-command: