Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] mime-view hook
@ 2009-04-23  1:11 Jon Dugan
  2009-04-23 12:47 ` William Morgan
  2009-04-23 17:53 ` Andrew Pimlott
  0 siblings, 2 replies; 5+ messages in thread
From: Jon Dugan @ 2009-04-23  1:11 UTC (permalink / raw)


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 <jdugan at es.net>          | GTalk: jdugan.esnet
ESnet Network Engineering Group       | http://www.es.net/
Lawrence Berkeley National Laboratory | http://www.lbl.gov/


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-04-23 22:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-23  1:11 [sup-talk] mime-view hook Jon Dugan
2009-04-23 12:47 ` William Morgan
2009-04-23 17:53 ` Andrew Pimlott
2009-04-23 18:14   ` Jon Dugan
2009-04-23 22:59     ` Andrew Pimlott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox