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
071efec2
Commit
071efec2
authored
Feb 15, 2017
by
Michael Goderbauer
Committed by
GitHub
Feb 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implements WindowsStdoutLogger (#8189)
Replaces unprintable characters with alternative symbols.
parent
fac9efba
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
executable.dart
packages/flutter_tools/lib/executable.dart
+1
-1
logger.dart
packages/flutter_tools/lib/src/base/logger.dart
+26
-1
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+1
-1
No files found.
packages/flutter_tools/lib/executable.dart
View file @
071efec2
...
@@ -105,7 +105,7 @@ Future<Null> main(List<String> args) async {
...
@@ -105,7 +105,7 @@ Future<Null> main(List<String> args) async {
context
.
putIfAbsent
(
Platform
,
()
=>
new
LocalPlatform
());
context
.
putIfAbsent
(
Platform
,
()
=>
new
LocalPlatform
());
context
.
putIfAbsent
(
FileSystem
,
()
=>
new
LocalFileSystem
());
context
.
putIfAbsent
(
FileSystem
,
()
=>
new
LocalFileSystem
());
context
.
putIfAbsent
(
ProcessManager
,
()
=>
new
LocalProcessManager
());
context
.
putIfAbsent
(
ProcessManager
,
()
=>
new
LocalProcessManager
());
context
.
putIfAbsent
(
Logger
,
()
=>
new
StdoutLogger
());
context
.
putIfAbsent
(
Logger
,
()
=>
platform
.
isWindows
?
new
WindowsStdoutLogger
()
:
new
StdoutLogger
());
// Order-independent context entries
// Order-independent context entries
context
.
putIfAbsent
(
DeviceManager
,
()
=>
new
DeviceManager
());
context
.
putIfAbsent
(
DeviceManager
,
()
=>
new
DeviceManager
());
...
...
packages/flutter_tools/lib/src/base/logger.dart
View file @
071efec2
...
@@ -6,6 +6,7 @@ import 'dart:async';
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'dart:convert'
show
ASCII
,
LineSplitter
;
import
'dart:convert'
show
ASCII
,
LineSplitter
;
import
'package:intl/intl.dart'
;
import
'package:intl/intl.dart'
;
import
'package:meta/meta.dart'
;
import
'package:stack_trace/stack_trace.dart'
;
import
'package:stack_trace/stack_trace.dart'
;
import
'io.dart'
;
import
'io.dart'
;
...
@@ -53,6 +54,7 @@ class Status {
...
@@ -53,6 +54,7 @@ class Status {
typedef
void
_FinishCallback
(
);
typedef
void
_FinishCallback
(
);
class
StdoutLogger
extends
Logger
{
class
StdoutLogger
extends
Logger
{
Status
_status
;
Status
_status
;
@override
@override
...
@@ -83,6 +85,11 @@ class StdoutLogger extends Logger {
...
@@ -83,6 +85,11 @@ class StdoutLogger extends Logger {
message
=
LineSplitter
.
split
(
message
).
map
((
String
line
)
=>
' '
*
indent
+
line
).
join
(
'
\n
'
);
message
=
LineSplitter
.
split
(
message
).
map
((
String
line
)
=>
' '
*
indent
+
line
).
join
(
'
\n
'
);
if
(
newline
)
if
(
newline
)
message
=
'
$message
\n
'
;
message
=
'
$message
\n
'
;
writeToStdOut
(
message
);
}
@protected
void
writeToStdOut
(
String
message
)
{
stdout
.
write
(
message
);
stdout
.
write
(
message
);
}
}
...
@@ -106,6 +113,24 @@ class StdoutLogger extends Logger {
...
@@ -106,6 +113,24 @@ class StdoutLogger extends Logger {
}
}
}
}
/// A [StdoutLogger] which replaces Unicode characters that cannot be printed to
/// the Windows console with alternative symbols.
///
/// This exists because of https://github.com/dart-lang/sdk/issues/28571.
class
WindowsStdoutLogger
extends
StdoutLogger
{
@override
void
writeToStdOut
(
String
message
)
{
stdout
.
write
(
message
.
replaceAll
(
'✗'
,
'X'
)
.
replaceAll
(
'✓'
,
'+'
)
.
replaceAll
(
'•'
,
'*'
)
);
// TODO(goderbauer): find a way to replace all other non-printable characters
// with the unrepresentable character symbol '�'
}
}
class
BufferLogger
extends
Logger
{
class
BufferLogger
extends
Logger
{
@override
@override
bool
get
isVerbose
=>
false
;
bool
get
isVerbose
=>
false
;
...
@@ -217,7 +242,7 @@ enum _LogType {
...
@@ -217,7 +242,7 @@ enum _LogType {
class
AnsiTerminal
{
class
AnsiTerminal
{
AnsiTerminal
()
{
AnsiTerminal
()
{
// TODO(devoncarew): This detection does not work for Windows.
// TODO(devoncarew): This detection does not work for Windows
(https://github.com/dart-lang/sdk/issues/28614)
.
String
term
=
platform
.
environment
[
'TERM'
];
String
term
=
platform
.
environment
[
'TERM'
];
supportsColor
=
term
!=
null
&&
term
!=
'dumb'
;
supportsColor
=
term
!=
null
&&
term
!=
'dumb'
;
}
}
...
...
packages/flutter_tools/lib/src/doctor.dart
View file @
071efec2
...
@@ -126,7 +126,7 @@ class Doctor {
...
@@ -126,7 +126,7 @@ class Doctor {
for
(
ValidationMessage
message
in
result
.
messages
)
{
for
(
ValidationMessage
message
in
result
.
messages
)
{
String
text
=
message
.
message
.
replaceAll
(
'
\n
'
,
'
\n
'
);
String
text
=
message
.
message
.
replaceAll
(
'
\n
'
,
'
\n
'
);
if
(
message
.
isError
)
{
if
(
message
.
isError
)
{
printStatus
(
'
x
$text
'
,
emphasis:
true
);
printStatus
(
'
✗
$text
'
,
emphasis:
true
);
}
else
{
}
else
{
printStatus
(
' •
$text
'
);
printStatus
(
' •
$text
'
);
}
}
...
...
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