-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
With the old DCLI NamedLock Package it would be:
await _lock.withLock(
() async {
find(
'.packages',
types: [Find.file],
workingDirectory: pathToProjectRoot,
).forEach(delete);
/// we cant delete directories whilst recusively scanning them.
final toBeDeleted = <String>[];
find(
'.dart_tool',
types: [Find.directory],
workingDirectory: pathToProjectRoot,
).forEach(toBeDeleted.add);
_deleteDirs(toBeDeleted);
find('pubspec.lock', workingDirectory: pathToProjectRoot)
.forEach(delete);
find('*.dart', workingDirectory: pathToProjectRoot)
.forEach((scriptPath) {
final script = DartScript.fromFile(scriptPath);
if (exists(script.pathToExe)) {
delete(script.pathToExe);
}
});
},
waiting: 'Waiting for clean to complete...',
);
And now with this package it would be:
final ExecutionCall<bool, Exception> _execution = NamedLock.guard(
name: name,
execution: ExecutionCall<bool, Exception>(
callable: () {
//...
return true;
},
waiting: 'Waiting for clean to complete...',
),
);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request