PluginProbe
ManageWP Worker / 4.9.25
ManageWP Worker v4.9.25
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / src / Symfony / Process / Pipes / AbstractPipes.php

AbstractPipes.php in ManageWP Worker 4.9.25, at src/Symfony/Process/Pipes/AbstractPipes.php

73 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 /**
13 * @author Romain Neutron <imprec@gmail.com>
14 *
15 * @internal
16 */
17 abstract class Symfony_Process_Pipes_AbstractPipes implements Symfony_Process_Pipes_PipesInterface
18 {
19 /** @var array */
20 public $pipes = array();
21
22 /** @var string */
23 protected $inputBuffer = '';
24 /** @var resource|null */
25 protected $input;
26
27 /** @var bool */
28 private $blocked = true;
29
30 /**
31 * {@inheritdoc}
32 */
33 public function close()
34 {
35 foreach ($this->pipes as $pipe) {
36 fclose($pipe);
37 }
38 $this->pipes = array();
39 }
40
41 /**
42 * Returns true if a system call has been interrupted.
43 *
44 * @return bool
45 */
46 protected function hasSystemCallBeenInterrupted()
47 {
48 $lastError = error_get_last();
49
50 // stream_select returns false when the `select` system call is interrupted by an incoming signal
51 return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call');
52 }
53
54 /**
55 * Unblocks streams
56 */
57 protected function unblock()
58 {
59 if (!$this->blocked) {
60 return;
61 }
62
63 foreach ($this->pipes as $pipe) {
64 stream_set_blocking($pipe, 0);
65 }
66 if (null !== $this->input) {
67 stream_set_blocking($this->input, 0);
68 }
69
70 $this->blocked = false;
71 }
72 }
73