4

I have this script here:

tmux send-keys "${@:1}" Enter sleep 2.5; tmux capture-pane -p -S -32767 

This script captures the tmux pane and prints the output. I noticed that if the tmux pane isn't opened, the output would look like this:

L 05/15/2018 - 16:07:43 : "thebravelittleMercen ary<348><[U:1:313493299 ]><Blue>" say "!resizem ytorso" BOI: !resizemyhands L 05/15/2018 - 16:07:44 : "BOI<377><[U:1:453920 082]><Red>" say "!resiz emyhands" 

In reality, it should look like this:

L 05/15/2018 - 16:07:43: "thebravelittleMercenary<348><[U:1:313493299]><Blue>" say "!resizemytorso" BOI: !resizemyhands L 05/15/2018 - 16:07:44: "BOI<377><[U:1:453920082]><Red>" say "!resizemyhands" 

It is worth mentioning that when I do tmux attach and capture the pane, the output lines have the same length as my console width: http://i.cubeupload.com/Rp1BEU.png

3
  • 1
    Maybe try capture-pane -J... Commented May 16, 2018 at 0:35
  • 1
    Oh that worked. I probably skipped through some important stuff in the manual Commented May 17, 2018 at 0:02
  • In some manual pages the option is buried, so possibly not easy to find either :) Commented May 18, 2018 at 4:41

1 Answer 1

9

The output is "wrapped" in the pane, so you'll want to use:

capture-pane -J 

-J joins wrapped lines and preserves trailing spaces at each line's end.

https://docs.oracle.com/cd/E86824_01/html/E54763/tmux-1.html

Sign up to request clarification or add additional context in comments.

1 Comment

On tmux 3.1c -J adds a bunch of trailing spaces to the end of most lines, seems to pad everything to 68 chars on a minimal terminal test with just echo a, so it's not ideal either.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.