/**
* Starts a wiremock process.
*
* @param string $jarPath
* @param string $logsPath
* @param string $arguments
*
* @throws \Exception
*/
public function start($ip, $port, $path, $logsPath, $debug)
{
$phiremockPath = is_file($path) ? $path : "{$path}/phiremock";
$this->process = new Process($this->getCommandPrefix() . "{$phiremockPath} -i {$ip} -p {$port}" . ($debug ? ' -d' : ''));
if ($debug) {
echo 'Executing: ' . $this->process->getCommandLine() . PHP_EOL;
}
$logFile = $logsPath . DIRECTORY_SEPARATOR . self::LOG_FILE_NAME;
$this->process->start(function ($type, $buffer) use($logFile) {
file_put_contents($logFile, $buffer, FILE_APPEND);
});
$this->process->setEnhanceSigchildCompatibility(true);
if ($this->isWindows()) {
$this->process->setEnhanceWindowsCompatibility(true);
}
}