写模式管道是否同步?

时间:2013-04-02 07:23:46

标签: linux pipe

以下代码是否会在调用abort()之前等待命令执行完成? 如果它没有并且父进程被中止,那么子(bash shell)是否存活并继续执行命令。

FILE *_popenShell = NULL;
_popenShell = popen("/bin/bash","w");
fwrite("some_command", 1, SOME_SIZE, _popenShell);
fflush(_popenShell);        
pclose(_popenShell);        
abort();

1 个答案:

答案 0 :(得分:0)

pclose()等待孩子终止(使用wait4())。在您点击abort()时,儿童不应该投放。

相关问题