Permalink
Browse files

Better error for mac+tmux [Fixes #23]

  • Loading branch information...
1 parent 471e600 commit fb05748e47e288c2ce4847c4f701d70b2da49de4 @ConradIrwin committed Apr 9, 2013
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/jist.rb
View
@@ -233,7 +233,16 @@ def on_success(body, options={})
#
def copy(content)
IO.popen(clipboard_command(:copy), 'r+') { |clip| clip.print content }
- raise Error, 'Copying to clipboard failed.' unless paste == content
+
+ unless paste == content
+ message = 'Copying to clipboard failed.'
+
+ if ENV["TMUX"] && clipboard_command(:copy) == 'pbcopy'
+ message << "\nIf you're running tmux on a mac, try http://robots.thoughtbot.com/post/19398560514/how-to-copy-and-paste-with-tmux-on-mac-os-x"
+ end
+
+ raise Error, message
+ end
rescue Error => e
raise ClipboardError, e.message + "\nAttempted to copy: #{content}"
end

0 comments on commit fb05748

Please sign in to comment.