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
ae207b5e
Unverified
Commit
ae207b5e
authored
Oct 25, 2019
by
Jonah Williams
Committed by
GitHub
Oct 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle permission error during flutter clean (#43401)
parent
eba69caf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
clean.dart
packages/flutter_tools/lib/src/commands/clean.dart
+7
-1
clean_test.dart
...lutter_tools/test/commands.shard/hermetic/clean_test.dart
+18
-0
No files found.
packages/flutter_tools/lib/src/commands/clean.dart
View file @
ae207b5e
...
...
@@ -83,7 +83,13 @@ class CleanCommand extends FlutterCommand {
@visibleForTesting
void
deleteFile
(
FileSystemEntity
file
)
{
if
(!
file
.
existsSync
())
{
// This will throw a FileSystemException if the directory is missing permissions.
try
{
if
(!
file
.
existsSync
())
{
return
;
}
}
on
FileSystemException
catch
(
err
)
{
printError
(
'Cannot clean
${file.path}
.
\n
$err
'
);
return
;
}
final
Status
deletionStatus
=
logger
.
startProgress
(
'Deleting
${file.basename}
...'
,
timeout:
timeoutConfiguration
.
fastOperation
);
...
...
packages/flutter_tools/test/commands.shard/hermetic/clean_test.dart
View file @
ae207b5e
...
...
@@ -80,6 +80,24 @@ void main() {
Logger:
()
=>
BufferLogger
(),
Xcode:
()
=>
mockXcode
,
});
testUsingContext
(
'
$CleanCommand
handles missing permissions;'
,
()
async
{
when
(
mockXcode
.
isInstalledAndMeetsVersionCheck
).
thenReturn
(
false
);
final
MockFile
mockFile
=
MockFile
();
when
(
mockFile
.
existsSync
()).
thenThrow
(
const
FileSystemException
(
'OS error: Access Denied'
));
when
(
mockFile
.
path
).
thenReturn
(
'foo.dart'
);
final
BufferLogger
logger
=
context
.
get
<
Logger
>();
final
CleanCommand
command
=
CleanCommand
();
command
.
deleteFile
(
mockFile
);
expect
(
logger
.
errorText
,
contains
(
'Cannot clean foo.dart'
));
verifyNever
(
mockFile
.
deleteSync
(
recursive:
true
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsPlatform
,
Logger:
()
=>
BufferLogger
(),
Xcode:
()
=>
mockXcode
,
});
}
test1
();
...
...
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