[flutter_tools] fix type error in flutter update-packages --jobs=n (#98283)
This commit is contained in:
committed by
GitHub
parent
fce2f93b75
commit
289988dc62
@@ -498,7 +498,9 @@ class UpdatePackagesCommand extends FlutterCommand {
|
||||
'Running "flutter pub get" in affected packages...',
|
||||
);
|
||||
try {
|
||||
final TaskQueue<void> queue = TaskQueue<void>(maxJobs: intArg('jobs'));
|
||||
// int.tryParse will convert an empty string to null
|
||||
final int/*?*/ maxJobs = int.tryParse(stringArg('jobs') ?? '');
|
||||
final TaskQueue<void> queue = TaskQueue<void>(maxJobs: maxJobs);
|
||||
for (final Directory dir in packages) {
|
||||
unawaited(queue.add(() async {
|
||||
final Stopwatch stopwatch = Stopwatch();
|
||||
|
||||
@@ -148,6 +148,30 @@ void main() {
|
||||
processManager: FakeProcessManager.any(),
|
||||
),
|
||||
});
|
||||
|
||||
testUsingContext('force updates packages --jobs=1', () async {
|
||||
final UpdatePackagesCommand command = UpdatePackagesCommand();
|
||||
await createTestCommandRunner(command).run(<String>[
|
||||
'update-packages',
|
||||
'--force-upgrade',
|
||||
'--jobs=1',
|
||||
]);
|
||||
expect(pub.pubGetDirectories, equals(<String>[
|
||||
'/.tmp_rand0/flutter_update_packages.rand0',
|
||||
'/flutter/examples',
|
||||
'/flutter/packages/flutter',
|
||||
]));
|
||||
expect(pub.pubBatchDirectories, equals(<String>[
|
||||
'/.tmp_rand0/flutter_update_packages.rand0',
|
||||
]));
|
||||
}, overrides: <Type, Generator>{
|
||||
Pub: () => pub,
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
Cache: () => Cache.test(
|
||||
processManager: FakeProcessManager.any(),
|
||||
),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user