array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w") ), $pipes); if (is_resource($process)) { stream_set_blocking($pipes[1], false); stream_set_blocking($pipes[2], false); stream_set_timeout($pipes[1], $timeout); stream_set_timeout($pipes[2], $timeout); $stdout = stream_get_contents($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); return array( 'stdout' => nl2br($stdout), 'stderr' => nl2br($stderr) ); } return false; } $command = "cd C:/novetus-windows/bin && NovetusCMD.exe --no3d --port " . $_POST['port'] . " --map \"" . $_POST['file'] . "\" --client " . $_POST['client']; $timeout = 10; $result = executeCommandWithTimeout($command, $timeout); if ($result === false) { echo "Process took longer than {$timeout} seconds and was killed."; } else { echo "Command output:\n"; echo "STDOUT:\n{$result['stdout']}\n"; echo "STDERR:\n{$result['stderr']}\n"; } } } ?>
by
Client:
/ ">