Mercurial > hg > cmmr2012-drupal-site
comparison vendor/symfony/process/Pipes/UnixPipes.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
46 public function getDescriptors() | 46 public function getDescriptors() |
47 { | 47 { |
48 if (!$this->haveReadSupport) { | 48 if (!$this->haveReadSupport) { |
49 $nullstream = fopen('/dev/null', 'c'); | 49 $nullstream = fopen('/dev/null', 'c'); |
50 | 50 |
51 return array( | 51 return [ |
52 array('pipe', 'r'), | 52 ['pipe', 'r'], |
53 $nullstream, | 53 $nullstream, |
54 $nullstream, | 54 $nullstream, |
55 ); | 55 ]; |
56 } | 56 } |
57 | 57 |
58 if ($this->ttyMode) { | 58 if ($this->ttyMode) { |
59 return array( | 59 return [ |
60 array('file', '/dev/tty', 'r'), | 60 ['file', '/dev/tty', 'r'], |
61 array('file', '/dev/tty', 'w'), | 61 ['file', '/dev/tty', 'w'], |
62 array('file', '/dev/tty', 'w'), | 62 ['file', '/dev/tty', 'w'], |
63 ); | 63 ]; |
64 } | 64 } |
65 | 65 |
66 if ($this->ptyMode && Process::isPtySupported()) { | 66 if ($this->ptyMode && Process::isPtySupported()) { |
67 return array( | 67 return [ |
68 array('pty'), | 68 ['pty'], |
69 array('pty'), | 69 ['pty'], |
70 array('pty'), | 70 ['pty'], |
71 ); | 71 ]; |
72 } | 72 } |
73 | 73 |
74 return array( | 74 return [ |
75 array('pipe', 'r'), | 75 ['pipe', 'r'], |
76 array('pipe', 'w'), // stdout | 76 ['pipe', 'w'], // stdout |
77 array('pipe', 'w'), // stderr | 77 ['pipe', 'w'], // stderr |
78 ); | 78 ]; |
79 } | 79 } |
80 | 80 |
81 /** | 81 /** |
82 * {@inheritdoc} | 82 * {@inheritdoc} |
83 */ | 83 */ |
84 public function getFiles() | 84 public function getFiles() |
85 { | 85 { |
86 return array(); | 86 return []; |
87 } | 87 } |
88 | 88 |
89 /** | 89 /** |
90 * {@inheritdoc} | 90 * {@inheritdoc} |
91 */ | 91 */ |
92 public function readAndWrite($blocking, $close = false) | 92 public function readAndWrite($blocking, $close = false) |
93 { | 93 { |
94 $this->unblock(); | 94 $this->unblock(); |
95 $w = $this->write(); | 95 $w = $this->write(); |
96 | 96 |
97 $read = $e = array(); | 97 $read = $e = []; |
98 $r = $this->pipes; | 98 $r = $this->pipes; |
99 unset($r[0]); | 99 unset($r[0]); |
100 | 100 |
101 // let's have a look if something changed in streams | 101 // let's have a look if something changed in streams |
102 set_error_handler(array($this, 'handleError')); | 102 set_error_handler([$this, 'handleError']); |
103 if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { | 103 if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { |
104 restore_error_handler(); | 104 restore_error_handler(); |
105 // if a system call has been interrupted, forget about it, let's try again | 105 // if a system call has been interrupted, forget about it, let's try again |
106 // otherwise, an error occurred, let's reset pipes | 106 // otherwise, an error occurred, let's reset pipes |
107 if (!$this->hasSystemCallBeenInterrupted()) { | 107 if (!$this->hasSystemCallBeenInterrupted()) { |
108 $this->pipes = array(); | 108 $this->pipes = []; |
109 } | 109 } |
110 | 110 |
111 return $read; | 111 return $read; |
112 } | 112 } |
113 restore_error_handler(); | 113 restore_error_handler(); |