From: jdugan@es.net (Jon Dugan)
Subject: [sup-talk] mime-view hook
Date: Wed, 22 Apr 2009 18:11:40 -0700 [thread overview]
Message-ID: <1240448213-sup-1757@junction.es.net> (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/
next reply other threads:[~2009-04-23 1:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-23 1:11 Jon Dugan [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1240448213-sup-1757@junction.es.net \
--to=jdugan@es.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox