Skip to content

Commit dbd264a

Browse files
committed
adds cache for isPtySupported()
1 parent 6c11207 commit dbd264a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Symfony/Component/Process/Process.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,24 @@ class Process
127127
*/
128128
public static function isPtySupported()
129129
{
130+
static $result;
131+
132+
if (null !== $result) {
133+
return $result;
134+
}
135+
130136
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
131-
return false;
137+
return $result = false;
132138
}
133139

134140
$proc = @proc_open('echo 1', array(array('pty'), array('pty'), array('pty')), $pipes);
135141
if (is_resource($proc)) {
136142
proc_close($proc);
137143

138-
return true;
144+
return $result = true;
139145
}
140146

141-
return false;
147+
return $result = false;
142148
}
143149

144150
/**

0 commit comments

Comments
 (0)