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
1b0fd265
Unverified
Commit
1b0fd265
authored
Mar 12, 2020
by
Dmitry Ratushnyy
Committed by
GitHub
Mar 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ISSUE-30478] Release cache dir lock acquired by a command on sigint or sigterm (#52194)
parent
04a1b78b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+1
-0
flutter_command_test.dart
...tools/test/general.shard/runner/flutter_command_test.dart
+37
-0
No files found.
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
1b0fd265
...
...
@@ -622,6 +622,7 @@ abstract class FlutterCommand extends Command<void> {
void
_registerSignalHandlers
(
String
commandPath
,
DateTime
startTime
)
{
final
SignalHandler
handler
=
(
io
.
ProcessSignal
s
)
{
Cache
.
releaseLockEarly
();
_sendPostUsage
(
commandPath
,
const
FlutterCommandResult
(
ExitStatus
.
killed
),
...
...
packages/flutter_tools/test/general.shard/runner/flutter_command_test.dart
View file @
1b0fd265
...
...
@@ -287,6 +287,43 @@ void main() {
SystemClock:
()
=>
clock
,
Usage:
()
=>
usage
,
});
testUsingContext
(
'command release lock on kill signal'
,
()
async
{
mockTimes
=
<
int
>[
1000
,
2000
];
final
Completer
<
void
>
completer
=
Completer
<
void
>();
setExitFunctionForTests
((
int
exitCode
)
{
expect
(
exitCode
,
0
);
restoreExitFunction
();
completer
.
complete
();
});
final
Completer
<
void
>
checkLockCompleter
=
Completer
<
void
>();
final
DummyFlutterCommand
flutterCommand
=
DummyFlutterCommand
(
commandFunction:
()
async
{
await
Cache
.
lock
();
checkLockCompleter
.
complete
();
final
Completer
<
void
>
c
=
Completer
<
void
>();
await
c
.
future
;
return
null
;
// unreachable
});
unawaited
(
flutterCommand
.
run
());
await
checkLockCompleter
.
future
;
Cache
.
checkLockAcquired
();
signalController
.
add
(
mockSignal
);
await
completer
.
future
;
await
Cache
.
lock
();
Cache
.
releaseLockEarly
();
},
overrides:
<
Type
,
Generator
>{
ProcessInfo:
()
=>
mockProcessInfo
,
Signals:
()
=>
FakeSignals
(
subForSigTerm:
signalUnderTest
,
exitSignals:
<
ProcessSignal
>[
signalUnderTest
],
),
Usage:
()
=>
usage
});
});
testUsingCommandContext
(
'report execution timing by default'
,
()
async
{
...
...
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