Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/process/ProcessBuilder.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
9 * file that was distributed with this source code. | 9 * file that was distributed with this source code. |
10 */ | 10 */ |
11 | 11 |
12 namespace Symfony\Component\Process; | 12 namespace Symfony\Component\Process; |
13 | 13 |
14 @trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use the Process class instead.', ProcessBuilder::class), E_USER_DEPRECATED); | |
15 | |
14 use Symfony\Component\Process\Exception\InvalidArgumentException; | 16 use Symfony\Component\Process\Exception\InvalidArgumentException; |
15 use Symfony\Component\Process\Exception\LogicException; | 17 use Symfony\Component\Process\Exception\LogicException; |
16 | 18 |
17 /** | 19 /** |
18 * Process builder. | 20 * @author Kris Wallsmith <kris@symfony.com> |
19 * | 21 * |
20 * @author Kris Wallsmith <kris@symfony.com> | 22 * @deprecated since version 3.4, to be removed in 4.0. Use the Process class instead. |
21 */ | 23 */ |
22 class ProcessBuilder | 24 class ProcessBuilder |
23 { | 25 { |
24 private $arguments; | 26 private $arguments; |
25 private $cwd; | 27 private $cwd; |
26 private $env = array(); | 28 private $env = array(); |
27 private $input; | 29 private $input; |
28 private $timeout = 60; | 30 private $timeout = 60; |
29 private $options = array(); | 31 private $options; |
30 private $inheritEnv = true; | 32 private $inheritEnv = true; |
31 private $prefix = array(); | 33 private $prefix = array(); |
32 private $outputDisabled = false; | 34 private $outputDisabled = false; |
33 | 35 |
34 /** | 36 /** |
35 * Constructor. | |
36 * | |
37 * @param string[] $arguments An array of arguments | 37 * @param string[] $arguments An array of arguments |
38 */ | 38 */ |
39 public function __construct(array $arguments = array()) | 39 public function __construct(array $arguments = array()) |
40 { | 40 { |
41 $this->arguments = $arguments; | 41 $this->arguments = $arguments; |
165 } | 165 } |
166 | 166 |
167 /** | 167 /** |
168 * Sets the input of the process. | 168 * Sets the input of the process. |
169 * | 169 * |
170 * @param resource|scalar|\Traversable|null $input The input content | 170 * @param resource|string|int|float|bool|\Traversable|null $input The input content |
171 * | 171 * |
172 * @return $this | 172 * @return $this |
173 * | 173 * |
174 * @throws InvalidArgumentException In case the argument is invalid | 174 * @throws InvalidArgumentException In case the argument is invalid |
175 */ | 175 */ |
260 { | 260 { |
261 if (0 === count($this->prefix) && 0 === count($this->arguments)) { | 261 if (0 === count($this->prefix) && 0 === count($this->arguments)) { |
262 throw new LogicException('You must add() command arguments before calling getProcess().'); | 262 throw new LogicException('You must add() command arguments before calling getProcess().'); |
263 } | 263 } |
264 | 264 |
265 $options = $this->options; | |
266 | |
267 $arguments = array_merge($this->prefix, $this->arguments); | 265 $arguments = array_merge($this->prefix, $this->arguments); |
268 $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments)); | 266 $process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options); |
269 | 267 // to preserve the BC with symfony <3.3, we convert the array structure |
270 $process = new Process($script, $this->cwd, $this->env, $this->input, $this->timeout, $options); | 268 // to a string structure to avoid the prefixing with the exec command |
269 $process->setCommandLine($process->getCommandLine()); | |
271 | 270 |
272 if ($this->inheritEnv) { | 271 if ($this->inheritEnv) { |
273 $process->inheritEnvironmentVariables(); | 272 $process->inheritEnvironmentVariables(); |
274 } | 273 } |
275 if ($this->outputDisabled) { | 274 if ($this->outputDisabled) { |