Re: Keeping a NSTask's standard input 'alive' after quitting theapp which created it ?
Re: Keeping a NSTask's standard input 'alive' after quitting theapp which created it ?
- Subject: Re: Keeping a NSTask's standard input 'alive' after quitting theapp which created it ?
- From: "David W. Halliday" <email@hidden>
- Date: Mon, 10 Dec 2001 23:03:56 -0600
- Organization: Latin AmeriCom, formerly Latino Online
Thomas Deniau wrote:
>
Hi!
>
>
I've a 'parent' app which launches a daemon using NSTask.
>
>
I set the daemon's standard input using
>
>
NSPipe *pipe=[NSPipe pipe];
>
[task setStandardInput:pipe];
>
>
Is there a way to keep pipe 'alive' after quitting the app which created it
>
(the 'parent'), and launched the task ?
It sounds like what you wish to do is to be able to attach to the "living" pipe
with another process, after the 'parent' process has gone away. Correct?
I'm sure you recognize that this would have to involve some method for
identifying this pipe so another process can attach to it (as opposed to just some
random free-floating pipe left behind by some previous process).
Well, if you really don't want to have a process hanging around holding onto
this pipe, a proper method (and a standard BSDism, at that) is to use Named Pipes.
(I would have to check the documentation for NSPipe to see if it supports this
directly.)
Of course if you are willing to have a Pipe serving process hanging around,
hanging onto this pipe, and serving it up to whatever other processes you wish to
attach to it, there are many inter-process communication methods available. (Of
course, you could simply have the 'daemon' you spawned in the first place do such
for itself and dispense with the pipe altogether.)
I hope this helps you in continuing your quest. We would probably need further
details if we are to help steer you further (without making potentially unwarranted
assumptions about what you ultimately intend to accomplish).
David email@hidden