Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1f7b8ae1
Commit
1f7b8ae1
authored
Mar 02, 2017
by
Michael Goderbauer
Committed by
GitHub
Mar 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable ANSI codes in PowerShell (#8537)
parent
e55c7239
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
flutter.ps1
bin/flutter.ps1
+29
-0
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+3
-2
No files found.
bin/flutter.ps1
0 → 100644
View file @
1f7b8ae1
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This is a wrapper arround flutter.bat, which checks if the terminal supports
# ANSI codes to work around https://github.com/dart-lang/sdk/issues/28614.
Add-Type
-MemberDefinition @
"
[DllImport("
kernel32.dll
", SetLastError=true)]
public static extern bool SetConsoleMode(IntPtr hConsoleHandle, int mode);
[DllImport("
kernel32.dll
", SetLastError=true)]
public static extern IntPtr GetStdHandle(int handle);
[DllImport("
kernel32.dll
", SetLastError=true)]
public static extern bool GetConsoleMode(IntPtr handle, out int mode);
"
@ -Namespace Win32 -Name NativeMethods
If
(
Test-Path
Env:\FLUTTER_ANSI_TERMINAL
)
{
Remove-Item
Env:\FLUTTER_ANSI_TERMINAL
}
$stdout
=
[
Win32.NativeMethods]::GetStdHandle
(
-11
)
# STD_OUTPUT_HANDLE
If
(
$stdout
-ne -1
)
{
$mode
=
0
$result
=
[
Win32.NativeMethods]::GetConsoleMode
(
$stdout
,
[
ref]
$mode
)
If
(
$result
)
{
$mode
=
$mode
-bor 4
# ENABLE_VIRTUAL_TERMINAL_PROCESSING
$env
:FLUTTER_ANSI_TERMINAL
=
[
Win32.NativeMethods]::SetConsoleMode
(
$stdout
,
$mode
)
}
}
flutter.bat
$args
exit
$LastExitCode
packages/flutter_tools/lib/src/base/logger.dart
View file @
1f7b8ae1
...
...
@@ -243,9 +243,10 @@ enum _LogType {
class
AnsiTerminal
{
AnsiTerminal
()
{
// TODO(devoncarew): This detection does not work for Windows (https://github.com/dart-lang/sdk/issues/28614).
String
term
=
platform
.
environment
[
'TERM'
];
supportsColor
=
term
!=
null
&&
term
!=
'dumb'
;
// 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
);
}
static
const
String
KEY_F1
=
'
\
u001BOP'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment