add example file

close smbclient connections properly
This commit is contained in:
root 2015-04-10 09:16:28 +02:00
commit 3a75f15ca3
3 changed files with 35 additions and 0 deletions

View file

@ -149,6 +149,20 @@ class RawConnection {
return;
}
if ($terminate) {
$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)) {
// try for case that posix_ functions are not available
try {
//9 is the SIGKILL signal
posix_kill($pid, 9);
} catch (\Exception $e) {
throw $e;
}
}
}
proc_terminate($this->process);
}
proc_close($this->process);