I'm running the mainline sup from git.

I have a mime-view.rb hook like this:

case content_type
when "text/html"
    Redwood::log("w3m: " + '/opt/local/bin/w3m -dump -T ' + content_type + ' ' 
+ filename)
    IO.popen('-') {|f| f ? f.read : exec('/opt/local/bin/w3m', '-dump', '-T', 
content_type, filename)}
else 
    Redwood::log("dumbplumb: " + filename)
    system '/Users/jdugan/projects/dumbplumb/dumbplumb', filename
end

It's supposed to render HTML in the SUP window and hand everything else off to
dumbplumb.  It does hand everything else off to dumbplub, however it doesn't
do what I expect for the HTML attachments.

Whatever gets returned from the hook should be displayed, right? 

I am a Ruby noob so maybe it's my Ruby that's bad.  (Although I've got a lot
of experience with Python, Perl, etc...)

If I send the output of the IO.popen to Redwood::log I see what I'd expect in
the log buffer, so I have confidence in the part that is using w3m to render
the HTML.

Why didn't I use backticks (`) instead of the calls to system and exec?
To sidestep shell quoting issues.  I started with backticks but attachments
with spaces and other shell meta characters were problematic.  

Thanks for any suggestions,

Jon

PS: dumbplumb may be of interest.  Here's the README:

dumbplumb is a simple mechanism for displaying files from remote systems
locally.  it is a brain dead hack that implements something which is something
like the Plan 9 plumber but not really.

Eventually it may be reworked to actually use the plan9 port plumber, but for
now it's just dumb.

dumbplumbd listens on port 9937 on your local system for requests.  dumbplumb
sends requests to dumbplumbd.  ssh port forwarding is used to proxy the two
together, eg:

ssh -R 9937:localhost:9937 remotehost

You can find dumbplumb at http://bitbucket.org/jdugan/dumbplumb/
-- 
Jon M. Dugan <jdu...@es.net>          | GTalk: jdugan.esnet
ESnet Network Engineering Group       | http://www.es.net/
Lawrence Berkeley National Laboratory | http://www.lbl.gov/
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk

Reply via email to