/** * Terminates the process and deletes the temporary files * @param string $fileId the unique file id generated by ProcMonitor::Start * @param int $procId the pid of the process to kill * @see ProcMonitor::Start() */ public function Close($fileId, $procId) { posix_kill($procId, 15); unlink(ProcMonitor::GetFName($fileId)); unlink(ProcMonitor::GetBytesFName($fileId)); }
<?php include "ProcMonitor.class.php"; list($fileId, $procId) = ProcMonitor::Start("locate home"); while (ProcMonitor::Running($procId) || ProcMonitor::OutputWaiting($fileId)) { print ProcMonitor::GetOutput($fileId); } ProcMonitor::Close($fileId, $procId);