sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit ed1b3629715f85bda6b69f1c11c6957471c0f7c2
parent f07de32c8629a9523175d31028a869986e873bd2
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Wed,  3 Oct 2007 19:52:07 +0000

fix write_to_disk error in attachment hook handling

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@599 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M lib/sup/message-chunks.rb | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb
@@ -77,13 +77,18 @@ EOS
     def expandable?; !viewable? end
     def viewable?; @lines.nil? end
     def view!
+      path = write_to_disk
+      system "/usr/bin/run-mailcap --action=view #{@content_type}:#{path} >& /dev/null"
+      $? == 0
+    end
+
+    def write_to_disk
       file = Tempfile.new "redwood.attachment"
       file.print @raw_content
       file.close
-      system "/usr/bin/run-mailcap --action=view #{@content_type}:#{file.path} >& /dev/null"
-      $? == 0
+      file.path
     end
-    
+
     ## used when viewing the attachment as text
     def to_s
       @lines || @raw_content