fix FLUTTER_ANSI_TERMINAL check (#8544)

* fix FLUTTER_ANSI_TERMINAL check

should have been included in the previous PR :(

* review comments
This commit is contained in:
Michael Goderbauer
2017-03-02 16:25:33 -08:00
committed by GitHub
parent c54cc96905
commit ae1a719e03
2 changed files with 6 additions and 5 deletions

View File

@@ -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"
}
}
}