On Wed, Jan 17, 2007 at 04:12:27PM -0800, Gary Johnson wrote:
>     image/*; mutt_bgrun xv %s; test=test "$TERM" != "screen" && RunningX

Is "RunningX" much like: test -n "$DISPLAY"

> When your
>     sh -c "exec display %s > /dev/null 2>&1 &"

Instead of asynchronously forking off a process, you could also use
a program that displays the image and immediately exits, avoiding
a race condition with respect to mutt doing something to the
original file after the handler exits.  Various image viewing
programs offer this (and don't necessarily imply that you lose the
ability to do things with a GUI; they may fork off a child to
handle such things, and have the parent exit when the child signals
it is ready).

> command returns to mutt, mutt immediately overwrites the temporary 
> file with nulls, then removes (unlinks) the file.

Hmm, that's an unfriendly way to do it.  I would open the file,
unlink it, then overwrite it (presumably this is for privacy), then
close the file descriptor.

That way, if there are multiple links to the file, you don't overwrite
them, leading to an elegant way of solving the race conditions mentioned
in this thread; simply create an additional hard link and then invoke
your handler on that.
-- 
``Unthinking respect for authority is the greatest enemy of truth.''
-- Albert Einstein -><- <URL:http://www.subspacefield.org/~travis/>

Attachment: pgpnrRv5jDbkn.pgp
Description: PGP signature

Reply via email to