The short version:

Can a parent process spawn a child, detach from it, exit, and leave the
child in control of stdin, stdout, stderr?



The long version:

I've got two terminal apps that I want to design to use each other and I'm
not sure if what I'm trying to do is possible.

As a user I run:
fooapp --option1 arg1 --option2 arg2

Then fooapp would prompt for the user for some input from the console and
then exec barapp (detached) with --opt-a arg-a --opt-b arg-b --callback-app
fooapp and barapp would have full control of stdin, stdout, stderr and
fooapp exits.

Then barapp takes some user input from the console and when it is done it
should call fooapp (detached) with --callback-data some-data and then let
itself exit.

In this way a python or golang app could call a node.js app and exit and
then the node.js app could reopen the python app with the data it needed
and from the user experience it appears as if only one program is running,
but actually it is two or three programs opening, interacting with the
user, opening the next with all stdin, etc attached to that process, and
then closing.

I don't know if I explained that well... probably not.




I was trying to do it with node.js because the documentation makes it sound
as though that is possible, but my little demo doesn't work. The child
process seems to lose stdin, stdout, stderr when detached.

AJ ONeal
(317) 426-6525

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to