Page MenuHomePhabricator

D21804.id51972.diff
No OneTemporary

D21804.id51972.diff

diff --git a/src/utils/PhutilSystem.php b/src/utils/PhutilSystem.php
--- a/src/utils/PhutilSystem.php
+++ b/src/utils/PhutilSystem.php
@@ -17,7 +17,7 @@
*/
public static function getStdinHandle() {
if (self::$stdin === false) {
- self::$stdin = self::newStdioHandle('php://stdin');
+ self::$stdin = self::getStdioHandle('STDIN');
}
return self::$stdin;
@@ -28,7 +28,7 @@
*/
public static function getStdoutHandle() {
if (self::$stdout === false) {
- self::$stdout = self::newStdioHandle('php://stdout');
+ self::$stdout = self::getStdioHandle('STDOUT');
}
return self::$stdout;
@@ -39,7 +39,7 @@
*/
public static function getStderrHandle() {
if (self::$stderr === false) {
- self::$stderr = self::newStdioHandle('php://stderr');
+ self::$stderr = self::getStdioHandle('STDERR');
}
return self::$stderr;
@@ -63,15 +63,12 @@
/**
* @task stdio
*/
- private static function newStdioHandle($ref) {
- $ignored_mode = '';
-
- $handle = @fopen($ref, $ignored_mode);
- if ($handle === false) {
- return null;
+ private static function getStdioHandle($ref) {
+ if (defined($ref)) {
+ return constant($ref);
}
- return $handle;
+ return null;
}
/**

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 12:03 PM (2 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7350550
Default Alt Text
D21804.id51972.diff (1 KB)

Event Timeline