logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: How to detect when stdout is closed?: msg#00049

Subject: Re: How to detect when stdout is closed?
=?UTF-8?Q?J=C3=B6rg?= Sommer <joerg@xxxxxxxxxxxx> wrote:
>I run a script with open_process(), but my _jed_quit_hooks isn't run
>everytime and due to this some spawned process remain. I use jed-script
>for this processes. How can I detect when stdout or stdin is closed? This
>way the client can quit itself, when Jed doesn't send him a signal
>before.

Is the subprocess a jed-script?  If so, you could always try a
variation of this slang code:

   parent_pid = getppid ();
      .
      .
   if (-1 == kill (parent_pid, 0))
     {
        % parent process has exited
        exit (1);
     }

>In pure SLang I found signal() and I think I could watch out for SIGHUP,
>but jed-script has not signal().

The signal handling functions in slang are not imported by jed because
jed makes extensive use of signals, and in particular catches SIGHUP.

Does this help?
Thanks,
--John



<Prev in Thread] Current Thread [Next in Thread>