switch to execvp, as system() does its own fork and can cause process to detach completely if parent process dies

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@677 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
imaginos
2006-03-04 09:25:27 +00:00
parent d67c711e2a
commit 775df4f8cf

View File

@@ -342,7 +342,14 @@ int CExecSock::popen2(int & iReadFD, int & iWriteFD, const CString & sCommand) {
dup2(rpipes[1], 2);
close(wpipes[0]);
close(rpipes[1]);
system( sCommand.c_str() );
char *pArgv[] =
{
"sh",
"-c",
(char *)sCommand.c_str(),
NULL
};
execvp( "sh", pArgv );
exit(0);
}