8000 Merge branch '5.4' into 6.4 · symfony/console@faaaa5e · GitHub
[go: up one dir, main page]

Skip to content

Commit faaaa5e

Browse files
Merge branch '5.4' into 6.4
* 5.4: Skip Twig v3.9-dev for now [Validator] Update Dutch (nl) translation Update Albanian translations [Validator] Update translation [FrameworkBundle] Prevent silenced warning by checking if /proc/mount exists [VarDumper][PhpUnitBridge] Fix color detection prevent throwing NOT_FOUND error when tube is empty [Validator] Update missing validator translation for Swedish [FrameworkBundle] Fix eager-loading of env vars in ConfigBuilderCacheWarmer [Messenger] Fix failing Redis test [Validator] Update Italian (it) translations [Validator] Missing translations for Hungarian (hu) #53769
2 parents ec17108 + f5436ad commit faaaa5e

File tree

2 files changed

+5
-35
lines changed

2 files changed

+5
-35
lines changed

Helper/QuestionHelper.php

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -501,19 +501,7 @@ private function isInteractiveInput($inputStream): bool
501501
return self::$stdinIsInteractive;
502502
}
503503

504-
if (\function_exists('stream_isatty')) {
505-
return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
506-
}
507-
508-
if (\function_exists('posix_isatty')) {
509-
return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
510-
}
511-
512-
if (!\function_exists('shell_exec')) {
513-
return self::$stdinIsInteractive = true;
514-
}
515-
516-
return self::$stdinIsInteractive = (bool) shell_exec('stty 2> '.('\\' === \DIRECTORY_SEPARATOR ? 'NUL' : '/dev/null'));
504+
return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
517505
}
518506

519507
/**

Output/StreamOutput.php

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ protected function hasColorSupport(): bool
101101
return false;
102102
}
103103

104-
if (\DIRECTORY_SEPARATOR === '\\'
105-
&& \function_exists('sapi_windows_vt100_support')
106-
&& @sapi_windows_vt100_support($this->stream)
107-
) {
104+
if ('\\' === \DIRECTORY_SEPARATOR && @sapi_windows_vt100_support($this->stream)) {
108105
return true;
109106
}
110107

@@ -116,14 +113,12 @@ protected function hasColorSupport(): bool
116113
return true;
117114
}
118115

119-
$term = (string) getenv('TERM');
120-
121-
if ('dumb' === $term) {
116+
if ('dumb' === $term = (string) getenv('TERM')) {
122117
return false;
123118
}
124119

125120
// See https://github.com/chalk/supports-color/blob/d4f413efaf8da045c5ab440ed418ef02dbb28bf1/index.js#L157
126-
return 1 === @preg_match('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/', $term);
121+
return preg_match('/^((screen|xterm|vt100|vt220|putty|rxvt|ansi|cygwin|linux).*)|(.*-256(color)?(-bce)?)$/', $term);
127122
}
128123

129124
/**
@@ -140,19 +135,6 @@ private function isTty(): bool
140135
return true;
141136
}
142137

143-
// Modern cross-platform function, includes the fstat fallback so if it is present we trust it
144-
if (\function_exists('stream_isatty')) {
145-
return stream_isatty($this->stream);
146-
}
147-
148-
// Only trusting this if it is positive, otherwise prefer fstat fallback.
149-
if (\function_exists('posix_isatty') && posix_isatty($this->stream)) {
150-
return true;
151-
}
152-
153-
$stat = @fstat($this->stream);
154-
155-
// Check if formatted mode is S_IFCHR
156-
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
138+
return @stream_isatty($this->stream);
157139
}
158140
}

0 commit comments

Comments
 (0)
0