Commit ae1a719e authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

fix FLUTTER_ANSI_TERMINAL check (#8544)

* fix FLUTTER_ANSI_TERMINAL check

should have been included in the previous PR :(

* review comments
parent c54cc969
......@@ -18,10 +18,11 @@ If (Test-Path Env:\FLUTTER_ANSI_TERMINAL) { Remove-Item Env:\FLUTTER_ANSI_TERMIN
$stdout = [Win32.NativeMethods]::GetStdHandle(-11) # STD_OUTPUT_HANDLE
If ($stdout -ne -1) {
$mode = 0
$result = [Win32.NativeMethods]::GetConsoleMode($stdout, [ref]$mode)
If ($result) {
If ([Win32.NativeMethods]::GetConsoleMode($stdout, [ref]$mode)) {
$mode = $mode -bor 4 # ENABLE_VIRTUAL_TERMINAL_PROCESSING
$env:FLUTTER_ANSI_TERMINAL = [Win32.NativeMethods]::SetConsoleMode($stdout, $mode)
If ([Win32.NativeMethods]::SetConsoleMode($stdout, $mode)) {
$env:FLUTTER_ANSI_TERMINAL = "true"
}
}
}
......
......@@ -245,8 +245,8 @@ class AnsiTerminal {
AnsiTerminal() {
String term = platform.environment['TERM'];
// FLUTTER_ANSI_TERMINAL is a work-around for https://github.com/dart-lang/sdk/issues/28614
String flutterAnsiTerm = platform.environment['FLUTTER_ANSI_TERMINAL'];
supportsColor = (term != null && term != 'dumb') || (flutterAnsiTerm != null);
bool flutterAnsiTerm = platform.environment.containsKey('FLUTTER_ANSI_TERMINAL');
supportsColor = (term != null && term != 'dumb') || flutterAnsiTerm;
}
static const String KEY_F1 = '\u001BOP';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment