質問

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!

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top