Created
March 26, 2015 17:20
-
-
Save twe4ked/f48cfa544536fbde7dd1 to your computer and use it in GitHub Desktop.
Grab the last output from tmux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# The maximum length of a multiplexed packet is 32,768 bytes | |
# | |
# Unfortunately this works best (only works) if you have an uncommon character | |
# in your prompt to split on. I use "»". | |
FILE = '/tmp/tmux-pane' | |
PROMPT = '»' | |
system "tmux capture-pane -S -32768 -p > #{FILE}" | |
print File.read(FILE). | |
split(PROMPT)[-2]. | |
lines[1..-2]. | |
join |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment