tmux ls -F formatting with shell command

69 views
Skip to first unread message

Matt Zagrabelny

unread,
Mar 22, 2018, 5:02:57 PM3/22/18
to tmux-users
Greetings,

I attempting to format the output of tmux ls -F:

$ tmux ls -F "#{session_name}: #(/home/user/tmux-utils/process-display #{pane_pid})" | head -1
189: <'/home/user/tmux-utils/process-display 8726' not ready>

I rerun the above command a few times and each time the "not ready" is displayed.

If I run the command manually, I get what I expect:

$ /home/user/tmux-utils/process-display 8726
(/home/user) -zsh

I was under the impression that the "ls formatting" for tmux needed to cache the values to display, but that doesn't seem to be happening. Any ideas as how to proceed?

Thanks!

-m

Nicholas Marriott

unread,
Mar 23, 2018, 3:41:37 AM3/23/18
to Matt Zagrabelny, tmux-users
ls -F does not wait for commands to finish so this will not work
reliably, you will need to do it in a script so the shell can do the
work. Something like:

tmux ls -F '#{session_name} #{pane_pid}'|while read i; do
set -- $i
echo $1 $(/home/user/tmux-utils/process-display $2)
done
> --
> You received this message because you are subscribed to the Google Groups
> "tmux-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to tmux-users+...@googlegroups.com.
> To post to this group, send email to tmux-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages