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
042fa8cf
Unverified
Commit
042fa8cf
authored
Aug 17, 2020
by
Jonah Williams
Committed by
GitHub
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] trim trailing newline from vm service logging events (#63976)
parent
c08ce783
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
10 deletions
+29
-10
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+7
-9
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+2
-1
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+10
-0
vmservice_test.dart
...ages/flutter_tools/test/general.shard/vmservice_test.dart
+10
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
042fa8cf
...
...
@@ -22,7 +22,6 @@ import '../base/terminal.dart';
import
'../base/utils.dart'
;
import
'../build_info.dart'
;
import
'../cache.dart'
;
import
'../convert.dart'
;
import
'../dart/language_version.dart'
;
import
'../dart/pub.dart'
;
import
'../devfs.dart'
;
...
...
@@ -731,14 +730,13 @@ class _ResidentWebRunner extends ResidentWebRunner {
_connectionResult
=
await
webDevFS
.
connect
(
useDebugExtension
);
unawaited
(
_connectionResult
.
debugConnection
.
onDone
.
whenComplete
(
_cleanupAndExit
));
_stdOutSub
=
_vmService
.
onStdoutEvent
.
listen
((
vmservice
.
Event
log
)
{
final
String
message
=
utf8
.
decode
(
base64
.
decode
(
log
.
bytes
));
globals
.
printStatus
(
message
,
newline:
false
);
});
_stdErrSub
=
_vmService
.
onStderrEvent
.
listen
((
vmservice
.
Event
log
)
{
final
String
message
=
utf8
.
decode
(
base64
.
decode
(
log
.
bytes
));
globals
.
printStatus
(
message
,
newline:
false
);
});
void
onLogEvent
(
vmservice
.
Event
event
)
{
final
String
message
=
processVmServiceMessage
(
event
);
globals
.
printStatus
(
message
);
}
_stdOutSub
=
_vmService
.
onStdoutEvent
.
listen
(
onLogEvent
);
_stdErrSub
=
_vmService
.
onStderrEvent
.
listen
(
onLogEvent
);
_extensionEventSub
=
_vmService
.
onExtensionEvent
.
listen
(
printStructuredErrorLog
);
try
{
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
042fa8cf
...
...
@@ -24,6 +24,7 @@ import '../macos/xcode.dart';
import
'../mdns_discovery.dart'
;
import
'../project.dart'
;
import
'../protocol_discovery.dart'
;
import
'../vmservice.dart'
;
import
'fallback_discovery.dart'
;
import
'ios_deploy.dart'
;
import
'ios_workflow.dart'
;
...
...
@@ -678,7 +679,7 @@ class IOSDeviceLogReader extends DeviceLogReader {
}
void
logMessage
(
vm_service
.
Event
event
)
{
final
String
message
=
utf8
.
decode
(
base64
.
decode
(
event
.
bytes
)
);
final
String
message
=
processVmServiceMessage
(
event
);
if
(
message
.
isNotEmpty
)
{
_linesController
.
add
(
message
);
}
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
042fa8cf
...
...
@@ -900,3 +900,13 @@ enum Brightness {
/// For example, the color might be bright white, requiring black text.
light
,
}
/// Process a VM service log event into a string message.
String
processVmServiceMessage
(
vm_service
.
Event
event
)
{
final
String
message
=
utf8
.
decode
(
base64
.
decode
(
event
.
bytes
));
// Remove extra trailing newlines appended by the vm service.
if
(
message
.
endsWith
(
'
\n
'
))
{
return
message
.
substring
(
0
,
message
.
length
-
1
);
}
return
message
;
}
packages/flutter_tools/test/general.shard/vmservice_test.dart
View file @
042fa8cf
...
...
@@ -402,6 +402,16 @@ void main() {
expect
(
vmService
.
httpAddress
,
null
);
expect
(
vmService
.
wsAddress
,
null
);
});
testWithoutContext
(
'Can process log events from the vm service'
,
()
{
final
vm_service
.
Event
event
=
vm_service
.
Event
(
bytes:
base64
.
encode
(
utf8
.
encode
(
'Hello There
\n
'
)),
timestamp:
0
,
kind:
vm_service
.
EventKind
.
kLogging
,
);
expect
(
processVmServiceMessage
(
event
),
'Hello There'
);
});
}
class
MockDevice
extends
Mock
implements
Device
{}
...
...
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