• Модуль: scale
  • Путь к файлу: ~/bitrix/modules/scale/lib/shelladapter.php
  • Класс: BitrixScaleShellAdapter
  • Вызов: ShellAdapter::syncExec
public function syncExec($command)
{
	$command = $this->prepareExecution($command);
	$retVal = 1;

	$descriptorspec = array(
		0 => array("pipe", "r"),  // stdin
		1 => array("pipe", "w"),  // stdout
		2 => array("pipe", "w") // stderr
	);

	$pipes = array();
	$process = proc_open('/bin/bash', $descriptorspec, $pipes);

	if (is_resource($process))
	{
		fwrite($pipes[0], $command);
		fclose($pipes[0]);

		$this->resOutput = stream_get_contents($pipes[1]);
		fclose($pipes[1]);

		$this->resError = stream_get_contents($pipes[2]);
		fclose($pipes[2]);

		$retVal = proc_close($process);
	}

	return $retVal == static::SUCCESS_RESULT;
}