main function

Future<void> main(
  1. List<String> args
)

Implementation

Future<void> main(List<String> args) async {
  if (args.length < 2) exit(64);

  final tempDirectory = Directory(args[0]);
  final ownerPid = int.tryParse(args[1]);
  if (ownerPid == null) exit(64);
  final watchOwner = args.contains("--watch");

  if (watchOwner) {
    await _waitForProcessExit(ownerPid);
  }

  if (!await tempDirectory.exists()) return;

  await for (final entity in tempDirectory.list()) {
    if (entity is! Directory) continue;
    await _cleanupPackageDirectory(entity, ownerPid);
  }
}