Unverified Commit 289988dc authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

[flutter_tools] fix type error in flutter update-packages --jobs=n (#98283)

parent fce2f93b
......@@ -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(),
),
});
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment