public function isRunning($pid)
    {
        $lastLine = exec(sprintf('tasklist /fi "PID eq %d" /nh /fo csv 2>nul:', $pid));
        $record = str_getcsv($lastLine);
        return isset($record[1]) && intval($record[1]) === $pid;
    }