mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Close smbclient connections properly (#2)
This commit is contained in:
parent
ef4b128143
commit
43e6c2e2d6
1 changed files with 12 additions and 0 deletions
|
|
@ -149,6 +149,18 @@ class RawConnection {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($terminate) {
|
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_terminate($this->process);
|
||||||
}
|
}
|
||||||
proc_close($this->process);
|
proc_close($this->process);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue