Skip to content

Instantly share code, notes, and snippets.

@wookayin
Created October 14, 2018 20:08
Show Gist options
  • Save wookayin/6e09c6af8612864484f791ee9297d6f7 to your computer and use it in GitHub Desktop.
Save wookayin/6e09c6af8612864484f791ee9297d6f7 to your computer and use it in GitHub Desktop.
Test script for reproducing a tmux passthrough bug
#!/bin/bash
function print_osc() {
if [[ -n $TMUX ]] ; then
printf "\033Ptmux;\033\033]";
else printf "\033]"; fi
}
function print_st() {
if [[ -n $TMUX ]] ; then
printf "\a\033\\"
else printf "\a"; fi
}
function send_file() {
# sends a dummy file containing $REPEAT '.' characters
REPEAT=${1:-1024}
filename=$(echo -ne "test-$REPEAT.txt" | base64)
echo "Sending a text data of $REPEAT bytes ..."
print_osc
printf "1337;File=name=$filename;size=$REPEAT;inline=0:"
head -c $REPEAT < /dev/zero | tr '\0' '.' | base64
print_st
}
send_file $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment