Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Ico Doornekamp <sup@zevv.nl>
To: Hamish <dmishd@gmail.com>
Cc: sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] editing messages outside of sup
Date: Tue, 05 Apr 2011 06:38:06 +0200	[thread overview]
Message-ID: <1301977961-sup-9660@pruts.nl> (raw)
In-Reply-To: <1301957971-sup-1165@whisper>

* On Tue Apr 05 01:01:18 +0200 2011, Hamish wrote:
 
> > When the infrastructure for background-editor hooks is there, I'm ready
> > to try to make the hook!
> 
> OK, I've pushed a change to allow hooks for this functionality. For now
> it is just on the async_message_edit branch (in the main gitorious
> repo).
> 
> To quote from the hook text:
> 
>   Runs when 'H' is pressed in async edit mode. You can run whatever code
>   you want here - though the default case would be launching a text
>   editor. Your hook is assumed to not block, so you should use exec() or
>   fork() to launch the editor.
> 
>   Once the hook has returned then sup will be responsive as usual. You will
>   still need to press 'E' to exit this buffer and send the message.

Sounds very useful to me!

> The next step would be to have the async mode exit as soon as the forked
> hook code has finished. The best way I've thought of to do this is to
> trap SIGUSR1. As long as there was only one async mode active this would
> work fine, but if there were two there would be trouble. I guess I could
> add a return value to the hook about whether to pay attention to
> SIGUSR1. Then the BufferManager could know which buffer was waiting for
> SIGUSR1. If a second buffer called the same hook while the first was
> still waiting for the signal, then it should refuse to honour it. It
> does feel a bit messy ... I might have a go at it at some point, but if
> anyone has other ideas, then please shout out.

I might have understood the details of your implementation wrong, but
why would it not just be possible to act on a SIGCHLD and use wait() to
retreive the pid and exitstatus of the finished process ? The pid would
distinguish the different async handlers, resolving the ambiguity ?

Thanks!

-- 
:wq
^X^Cy^K^X^C^C^C^C
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


      reply	other threads:[~2011-04-05  5:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-20 22:02 Hamish
2011-02-26 19:23 ` Hamish
2011-02-27  1:15   ` Alvaro Herrera
2011-02-27  2:51     ` Roni Choudhury
2011-02-27 15:31       ` Ico Doornekamp
2011-02-27 17:20         ` Hamish
2011-02-27 19:44           ` Ico Doornekamp
2011-04-04 23:01             ` Hamish
2011-04-05  4:38               ` Ico Doornekamp [this message]

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=1301977961-sup-9660@pruts.nl \
    --to=sup@zevv.nl \
    --cc=dmishd@gmail.com \
    --cc=sup-devel@rubyforge.org \
    /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