|
@ -206,7 +206,7 @@ namespace pEp { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: hack
|
|
|
// TODO: hack move to _executeOnFork()
|
|
|
setenv("HOME", getProcessDir().c_str(), true); |
|
|
setenv("HOME", getProcessDir().c_str(), true); |
|
|
|
|
|
|
|
|
// Execute in fork and wait here until process ends
|
|
|
// Execute in fork and wait here until process ends
|
|
@ -333,11 +333,13 @@ namespace pEp { |
|
|
_waitChildProcesses(); |
|
|
_waitChildProcesses(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void AbstractPityUnit::_executeInFork(std::function<void(void)> func, bool wait_child) const |
|
|
void AbstractPityUnit::_executeInFork(std::function<void(void)> func, bool wait_child) |
|
|
{ |
|
|
{ |
|
|
pid_t pid; |
|
|
pid_t pid; |
|
|
pid = fork(); |
|
|
pid = fork(); |
|
|
if (pid == pid_t(0)) { |
|
|
if (pid == pid_t(0)) { |
|
|
|
|
|
// Setup process env.
|
|
|
|
|
|
Utils::dir_set_cwd(getProcessDir()); |
|
|
func(); |
|
|
func(); |
|
|
exit(0); |
|
|
exit(0); |
|
|
} else if (pid < pid_t(0)) { |
|
|
} else if (pid < pid_t(0)) { |
|
|