Domanda

I have created an application that launches a couple of child processes using fork and execv.

string process;  //initialized before execv call
char** process_args;  //initialized before execv call
int pid = fork();
if(pid == 0) {
    execv(process.c_str(), process_args);
}

The processes launch, but they block the parent's access to STDIN until every child exits. I would like the parent process to have access to STDIN while the child processes are still running.

Is this possible, and if so - how? I don't have to use execv. The processes don't really need to have any notion of each other once they are launched.

Thanks!

È stato utile?

Soluzione

Close the child's STDIN before exec*().

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top