jed-users mailing list

[2007 Date Index] [2007 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: How to detect when stdout is closed?


Hello John,

"John E. Davis" <davis@xxxxxxxxxxxxx> wrote:
> =?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);
>      }
>
> Does this help?

Not really. The functions is blocked in a fopen() so I can't check for
this regularly.

forever
{
    variable fifo = fopen(fifo_name, "r");
    try
    {
        variable line;
        while (fgets(&line, fifo) != -1)
          message(line);

        if (line == "quit")
          break;
    }
    finally
      () = fclose(fifo);
}

BTW: What's your decision regarding the window popup problem for XJed?
  It's not possible to bring XJed in forground, if it isn't active.
  suspend() suspends the editor, if it hasn't the focus, but I want to
  raise it as requested from another application.

Bye, Jörg.
-- 
Es gibt nichts schöneres als dem Schweigen eines Dummkopfes zuzuhören.
   	       		      	  	        (Helmut Quatlinger)

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2007 date index] [2007 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]