@@ -27,7 +27,7 @@ a command in a sub-process::
27
27
use Symfony\Component\Process\Process;
28
28
use Symfony\Component\Process\Exception\ProcessFailedException;
29
29
30
- $process = new Process([ 'ls', '-lsa'] );
30
+ $process = new Process(array( 'ls', '-lsa') );
31
31
$process->run();
32
32
33
33
// executes after the command finishes
@@ -55,7 +55,7 @@ You can also use the :class:`Symfony\\Component\\Process\\Process` class with th
55
55
foreach construct to get the output while it is generated. By default, the loop waits
56
56
for new output before going to the next iteration::
57
57
58
- $process = new Process([ 'ls', '-lsa'] );
58
+ $process = new Process(array( 'ls', '-lsa') );
59
59
$process->start();
60
60
61
61
foreach ($process as $type => $data) {
@@ -72,7 +72,7 @@ for new output before going to the next iteration::
72
72
it is generated. That iterator is exposed via the ``getIterator() `` method
73
73
to allow customizing its behavior::
74
74
75
- $process = new Process([ 'ls', '-lsa'] );
75
+ $process = new Process(array( 'ls', '-lsa') );
76
76
$process->start();
77
77
$iterator = $process->getIterator($process::ITER_SKIP_ERR | $process::ITER_KEEP_OUTPUT);
78
78
foreach ($iterator as $data) {
@@ -90,7 +90,7 @@ with a non-zero code)::
90
90
use Symfony\Component\Process\Exception\ProcessFailedException;
91
91
use Symfony\Component\Process\Process;
92
92
93
- $process = new Process([ 'ls', '-lsa'] );
93
+ $process = new Process(array( 'ls', '-lsa') );
94
94
95
95
try {
96
96
$process->mustRun();
@@ -125,7 +125,7 @@ with a non-zero code)::
125
125
$process = new Process('echo %MESSAGE%');
126
126
127
127
// On both Unix-like and Windows
128
- $process->run(null, [ 'MESSAGE' => 'Something to output']);
128
+ $process->run(null, 'MESSAGE' => 'Something to output']);
129
129
130
130
Getting real-time Process Output
131
131
--------------------------------
@@ -137,7 +137,7 @@ anonymous function to the
137
137
138
138
use Symfony\Component\Process\Process;
139
139
140
- $process = new Process([ 'ls', '-lsa'] );
140
+ $process = new Process(array( 'ls', '-lsa') );
141
141
$process->run(function ($type, $buffer) {
142
142
if (Process::ERR === $type) {
143
143
echo 'ERR > '.$buffer;
@@ -156,7 +156,7 @@ process, the :method:`Symfony\\Component\\Process\\Process::isRunning` method
156
156
to check if the process is done and the
157
157
:method: `Symfony\\ Component\\ Process\\ Process::getOutput ` method to get the output::
158
158
159
- $process = new Process([ 'ls', '-lsa'] );
159
+ $process = new Process(array( 'ls', '-lsa') );
160
160
$process->start();
161
161
162
162
while ($process->isRunning()) {
@@ -168,7 +168,7 @@ to check if the process is done and the
168
168
You can also wait for a process to end if you started it asynchronously and
169
169
are done doing other stuff::
170
170
171
- $process = new Process([ 'ls', '-lsa'] );
171
+ $process = new Process(array( 'ls', '-lsa') );
172
172
$process->start();
173
173
174
174
// ... do other things
@@ -207,7 +207,7 @@ are done doing other stuff::
207
207
a callback that is called repeatedly whilst the process is still running, passing
208
208
in the output and its type::
209
209
210
- $process = new Process([ 'ls', '-lsa'] );
210
+ $process = new Process(array( 'ls', '-lsa') );
211
211
$process->start();
212
212
213
213
$process->wait(function ($type, $buffer) {
@@ -226,7 +226,7 @@ Before a process is started, you can specify its standard input using either the
226
226
of the constructor. The provided input can be a string, a stream resource or a
227
227
Traversable object::
228
228
229
- $process = new Process([ 'cat']);
229
+ $process = new Process('cat']);
230
230
$process->setInput('foobar');
231
231
$process->run();
232
232
@@ -239,7 +239,7 @@ provides the :class:`Symfony\\Component\\Process\\InputStream` class::
239
239
$input = new InputStream();
240
240
$input->write('foo');
241
241
242
- $process = new Process([ 'cat'] );
242
+ $process = new Process(array( 'cat') );
243
243
$process->setInput($input);
244
244
$process->start();
245
245
@@ -265,7 +265,7 @@ The input of a process can also be defined using `PHP streams`_::
265
265
266
266
$stream = fopen('php://temporary', 'w+');
267
267
268
- $process = new Process([ 'cat'] );
268
+ $process = new Process(array( 'cat') );
269
269
$process->setInput($stream);
270
270
$process->start();
271
271
@@ -291,7 +291,7 @@ is sent to the running process. The default signal sent to a process is ``SIGKIL
291
291
Please read the :ref: `signal documentation below<reference-process-signal> `
292
292
to find out more about signal handling in the Process component::
293
293
294
- $process = new Process([ 'ls', '-lsa'] );
294
+ $process = new Process(array( 'ls', '-lsa') );
295
295
$process->start();
296
296
297
297
// ... do other things
@@ -320,7 +320,7 @@ timeout (in seconds)::
320
320
321
321
use Symfony\Component\Process\Process;
322
322
323
- $process = new Process([ 'ls', '-lsa'] );
323
+ $process = new Process(array( 'ls', '-lsa') );
324
324
$process->setTimeout(3600);
325
325
$process->run();
326
326
@@ -352,7 +352,7 @@ considers the time since the last output was produced by the process::
352
352
353
353
use Symfony\Component\Process\Process;
354
354
355
- $process = new Process([ 'something-with-variable-runtime'] );
355
+ $process = new Process(array( 'something-with-variable-runtime') );
356
356
$process->setTimeout(3600);
357
357
$process->setIdleTimeout(60);
358
358
$process->run();
@@ -368,7 +368,7 @@ When running a program asynchronously, you can send it POSIX signals with the
368
368
369
369
use Symfony\Component\Process\Process;
370
370
371
- $process = new Process([ 'find', '/', '-name', 'rabbit'] );
371
+ $process = new Process(array( 'find', '/', '-name', 'rabbit') );
372
372
$process->start();
373
373
374
374
// will send a SIGKILL to the process
@@ -382,7 +382,7 @@ You can access the `pid`_ of a running process with the
382
382
383
383
use Symfony\Component\Process\Process;
384
384
385
- $process = new Process([ '/usr/bin/php', 'worker.php'] );
385
+ $process = new Process(array( '/usr/bin/php', 'worker.php') );
386
386
$process->start();
387
387
388
388
$pid = $process->getPid();
@@ -397,7 +397,7 @@ Use :method:`Symfony\\Component\\Process\\Process::disableOutput` and
397
397
398
398
use Symfony\Component\Process\Process;
399
399
400
- $process = new Process([ '/usr/bin/php', 'worker.php'] );
400
+ $process = new Process(array( '/usr/bin/php', 'worker.php') );
401
401
$process->disableOutput();
402
402
$process->run();
403
403
0 commit comments