Merge pull request #27 from mmattel/close_child_processes_of_smbclient_II

Close smbclient connections properly (#2)
This commit is contained in:
Robin Appelman 2015-04-10 14:07:04 +02:00
commit e36beec276

View file

@ -149,6 +149,18 @@ class RawConnection {
return;
}
if ($terminate) {
// if for case that posix_ functions are not available
if (function_exists('posix_kill')) {
$status = proc_get_status($this->process);
$ppid = $status['pid'];
$pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`);
foreach($pids as $pid) {
if(is_numeric($pid)) {
//9 is the SIGKILL signal
posix_kill($pid, 9);
}
}
}
proc_terminate($this->process);
}
proc_close($this->process);