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
cd725e36
Unverified
Commit
cd725e36
authored
Mar 14, 2022
by
Emmanuel Garcia
Committed by
GitHub
Mar 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure dart_plugin_registry shows stderr and exits when process exits (#99936)
parent
f2646b15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
18 deletions
+51
-18
dart_plugin_registry_tests.dart
dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart
+51
-18
No files found.
dev/devicelab/lib/tasks/dart_plugin_registry_tests.dart
View file @
cd725e36
...
...
@@ -142,36 +142,69 @@ class ApluginPlatformInterfaceMacOS {
section
(
'Flutter run for macos'
);
late
Process
run
;
await
inDirectory
(
path
.
join
(
tempDir
.
path
,
'app'
),
()
async
{
final
Process
run
=
await
startProcess
(
run
=
await
startProcess
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
flutterCommandArgs
(
'run'
,
<
String
>[
'-d'
,
'macos'
,
'-v'
]),
);
Completer
<
void
>
registryExecutedCompleter
=
Completer
<
void
>();
final
StreamSubscription
<
void
>
subscription
=
run
.
stdout
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
if
(
line
.
contains
(
'ApluginPlatformInterfaceMacOS.registerWith() was called'
))
{
});
Completer
<
void
>
registryExecutedCompleter
=
Completer
<
void
>();
final
StreamSubscription
<
void
>
stdoutSub
=
run
.
stdout
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
if
(
line
.
contains
(
'ApluginPlatformInterfaceMacOS.registerWith() was called'
))
{
registryExecutedCompleter
.
complete
();
}
print
(
'stdout:
$line
'
);
});
section
(
'Wait for registry execution'
);
await
registryExecutedCompleter
.
future
;
final
StreamSubscription
<
void
>
stderrSub
=
run
.
stderr
.
transform
<
String
>(
utf8
.
decoder
)
.
transform
<
String
>(
const
LineSplitter
())
.
listen
((
String
line
)
{
print
(
'stderr:
$line
'
);
});
// Hot restart.
run
.
stdin
.
write
(
'R'
);
registryExecutedCompleter
=
Completer
<
void
>();
final
Future
<
void
>
stdoutDone
=
stdoutSub
.
asFuture
<
void
>();
final
Future
<
void
>
stderrDone
=
stderrSub
.
asFuture
<
void
>();
section
(
'Wait for registry execution after hot restart'
);
await
registryExecutedCompleter
.
future
;
Future
<
void
>
waitForStreams
()
{
return
Future
.
wait
<
void
>(<
Future
<
void
>>[
stdoutDone
,
stderrDone
]);
}
Future
<
void
>
waitOrExit
(
Future
<
void
>
future
)
async
{
final
dynamic
result
=
await
Future
.
any
<
dynamic
>(
<
Future
<
dynamic
>>[
future
,
run
.
exitCode
,
],
);
if
(
result
is
int
)
{
await
waitForStreams
();
throw
'process exited with code
$result
'
;
}
}
section
(
'Wait for registry execution'
);
await
waitOrExit
(
registryExecutedCompleter
.
future
);
// Hot restart.
run
.
stdin
.
write
(
'R'
);
registryExecutedCompleter
=
Completer
<
void
>();
section
(
'Wait for registry execution after hot restart'
);
await
waitOrExit
(
registryExecutedCompleter
.
future
);
run
.
kill
();
await
waitForStreams
();
unawaited
(
stdoutSub
.
cancel
());
unawaited
(
stderrSub
.
cancel
());
unawaited
(
subscription
.
cancel
());
run
.
kill
();
});
return
TaskResult
.
success
(
null
);
}
finally
{
rmTree
(
tempDir
);
...
...
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