@@ -98,20 +98,22 @@ are done doing other stuff::
98
98
99
99
.. note ::
100
100
101
- Please consider that the :method: `Symfony\\ Component\\ Process\\ Process::wait `
102
- method is blocking.
101
+ The :method: `Symfony\\ Component\\ Process\\ Process::wait ` method is blocking,
102
+ which means that your code will halt at this line until the external
103
+ process is completed.
104
+
105
+ Stopping a Process
106
+ ~~~~~~~~~~~~~~~~~~
103
107
104
108
.. versionadded :: 2.3
105
109
The ``signal `` parameter of the ``stop `` method was added in Symfony 2.3.
106
110
107
111
Any asynchronous process can be stopped at any time with the
108
112
:method: `Symfony\\ Component\\ Process\\ Process::stop ` method. This method takes
109
113
two arguments : a timeout and a signal. Once the timeout is reached, the signal
110
- is sent to the running process.
111
- The default signal sent to a process is ``SIGKILL ``. Please read the signal
112
- documentation below to know more about signal handling in the Process component.
113
-
114
- .. code-block :: php
114
+ is sent to the running process. The default signal sent to a process is ``SIGKILL ``.
115
+ Please read the :ref: `signal documentation below<reference-process-signal> `
116
+ to find out more about signal handling in the Process component::
115
117
116
118
$process = new Process('ls -lsa');
117
119
$process->start();
@@ -172,16 +174,16 @@ check regularly::
172
174
usleep(200000);
173
175
}
174
176
177
+ .. _reference-process-signal :
178
+
175
179
Process Signals
176
180
---------------
177
181
178
182
.. versionadded :: 2.3
179
183
The ``signal `` method was added in Symfony 2.3.
180
184
181
- When running programs asynchronously, you can send it posix signals with the
182
- :method: `Symfony\\ Component\\ Process\\ Process::signal ` method.
183
-
184
- .. code-block :: php
185
+ When running a program asynchronously, you can send it posix signals with the
186
+ :method: `Symfony\\ Component\\ Process\\ Process::signal ` method::
185
187
186
188
use Symfony\Component\Process\Process;
187
189
@@ -195,7 +197,7 @@ When running programs asynchronously, you can send it posix signals with the
195
197
196
198
Due to some limitations in PHP, if you're using signals with the Process
197
199
component, you may have to prefix your commands with `exec `_. Please read
198
- `Symfony Issue#5769 `_ and `PHP Bug#39992 `_ to understand why this is happening.
200
+ `Symfony Issue#5759 `_ and `PHP Bug#39992 `_ to understand why this is happening.
199
201
200
202
POSIX signals are not available on Windows platforms, please refer to the
201
203
`PHP documentation `_ for available signals.
@@ -222,11 +224,11 @@ You can access the `pid`_ of a running process with the
222
224
223
225
Due to some limitations in PHP, if you want to get the pid of a symfony Process,
224
226
you may have to prefix your commands with `exec `_. Please read
225
- `Symfony Issue#5769 `_ to understand why this is happening.
227
+ `Symfony Issue#5759 `_ to understand why this is happening.
226
228
227
- .. _ Symfony Issue#5759 : https://github.com/symfony/symfony/issues/5759
228
- .. _ PHP Bug#39992 : https://bugs.php.net/bug.php?id=39992
229
- .. _ exec : http://en.wikipedia.org/wiki/Exec_(operating_system)
230
- .. _ pid : http://en.wikipedia.org/wiki/Process_identifier
231
- .. _ PHP Documentation : http://php.net/manual/en/pcntl.constants.php
229
+ .. _ `Symfony Issue#5759` : https://github.com/symfony/symfony/issues/5759
230
+ .. _ `PHP Bug#39992` : https://bugs.php.net/bug.php?id=39992
231
+ .. _ `exec` : http://en.wikipedia.org/wiki/Exec_(operating_system)
232
+ .. _ `pid` : http://en.wikipedia.org/wiki/Process_identifier
233
+ .. _ `PHP Documentation` : http://php.net/manual/en/pcntl.constants.php
232
234
.. _Packagist : https://packagist.org/packages/symfony/process
0 commit comments