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

Need help with running shell command on pane-exited with set-hook #3736

Open
nataraj-hates-MS-for-stealing-github opened this issue Nov 2, 2023 · 3 comments

Comments

@nataraj-hates-MS-for-stealing-github

Hi I am using tumux 3.3a on Debain 12,

I am trying to set run-command coomand on pane-exited hook, but this all does not work as I expect...

I wrote sample test.sh file

#!/bin/sh

SLEEP=10

P1=`tmux split-window -d -P  -F '#{pane_id}' -h 'echo This is a PLACEHOLDER pane; while true ; do sleep 1 ; done'`
P2=`tmux new-window -P -d -n sleep-pane -F '#{pane_id}' "sleep $SLEEP"`
P3=`tmux set-hook -p -t $P2  pane-exited[0] 'run-shell -b "echo woke up > res "' 2>&1`   

echo $P1 $P2 $P3 >panes.log

I expect woke up to be printed into res file as soon as sleep in P2 is over. But I am not getting it.

It works with -g option, but I'd prefer to have per-pane rules set...

I tried all ways I can imagine, but I still do not get what I need. I guess I am not doing something right, but I do not understand what is wrong with it...

@nicm
Copy link
Member

nicm commented Nov 3, 2023

Hooks on things that are being destroyed don't work very well, I think you will need to use a global hook for the moment.

@nataraj-hates-MS-for-stealing-github

Hooks on things that are being destroyed don't work very well, I think you will need to use a global hook for the moment.

Thanks! Will do that way. Are there any hope it will start working later?

@nicm
Copy link
Member

nicm commented Nov 3, 2023

Dunno, not sure what is wrong and I don't have time to figure it out.

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

No branches or pull requests

2 participants