There has absolutely got to be a better way to do this.
temp_file ||= Tempfile.new()
system("stty -echo; tput u7; read -d R x; stty echo; echo ${x#??} > #{temp_file.path}")
temp_file.gets.chomp.split(';').map(&:to_i)
Basically, I'm running the bash script from this question in a sub process and then reading the output from a redirected file.
Without using C or any gems (stdlib okay) what is a better way to do this? Cross compatibility is not of great concern.