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
c5d5463c
Unverified
Commit
c5d5463c
authored
Aug 14, 2021
by
Zachary Anderson
Committed by
GitHub
Aug 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Fix hang in DesktopLogReader (#88178)
parent
325cfb0f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
16 deletions
+11
-16
desktop_device.dart
packages/flutter_tools/lib/src/desktop_device.dart
+7
-7
desktop_device_test.dart
...flutter_tools/test/general.shard/desktop_device_test.dart
+4
-9
No files found.
packages/flutter_tools/lib/src/desktop_device.dart
View file @
c5d5463c
...
...
@@ -314,15 +314,15 @@ class DesktopLogReader extends DeviceLogReader {
final
StreamSubscription
<
List
<
int
>>
stderrSub
=
process
.
stderr
.
listen
(
_inputController
.
add
,
);
final
Future
<
void
>
stdioFuture
=
Future
.
wait
<
void
>(<
Future
<
void
>>[
stdoutSub
.
asFuture
<
void
>(),
stderrSub
.
asFuture
<
void
>(),
]);
process
.
exitCode
.
whenComplete
(()
async
{
// Wait for output to be fully processed.
await
Future
.
wait
<
void
>(<
Future
<
void
>>[
stdoutSub
.
asFuture
<
void
>(),
stderrSub
.
asFuture
<
void
>(),
]);
// The streams as futures have already completed, so waiting for the
// potentially async stream cancellation to complete likely has no
// benefit.
await
stdioFuture
;
// The streams have already completed, so waiting for the stream
// cancellation to complete is not needed.
unawaited
(
stdoutSub
.
cancel
());
unawaited
(
stderrSub
.
cancel
());
await
_inputController
.
close
();
...
...
packages/flutter_tools/test/general.shard/desktop_device_test.dart
View file @
c5d5463c
...
...
@@ -289,17 +289,13 @@ void main() {
final
FakeDesktopDevice
device
=
setUpDesktopDevice
(
processManager:
processManager
,
);
final
Completer
<
void
>
testCompleter
=
Completer
<
void
>();
final
List
<
String
>
logOutput
=
<
String
>[];
device
.
getLogReader
().
logLines
.
listen
((
String
line
)
{
logOutput
.
add
(
line
);
},
onDone:
()
{
expect
(
logOutput
,
contains
(
'Oops'
));
testCompleter
.
complete
();
});
unawaited
(
Future
<
void
>(()
{
exitCompleter
.
complete
();
}));
// Start looking for 'Oops' in the stream before starting the app.
expect
(
device
.
getLogReader
().
logLines
,
emits
(
'Oops'
));
final
FakeApplicationPackage
package
=
FakeApplicationPackage
();
await
device
.
startApp
(
package
,
...
...
@@ -309,7 +305,6 @@ void main() {
dartEntrypointArgs:
<
String
>[
'arg1'
,
'arg2'
],
),
);
await
testCompleter
.
future
;
});
}
...
...
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