generateVmServiceInfoFile method

File generateVmServiceInfoFile()

Creates a temp folder for the VM to write the service-info-file into and returns the File to use.

Implementation

File generateVmServiceInfoFile() {
  // Using tmpDir.createTemporary() is flakey on Windows+Linux (at least
  // on GitHub Actions) complaining the file does not exist when creating a
  // watcher. Creating/watching a folder and writing the file into it seems
  // to be reliable.
  final serviceInfoFilePath = path.join(
    normalizePath(
        Directory.systemTemp.createTempSync('dart-vm-service').path),
    'vm.json',
  );

  return File(serviceInfoFilePath);
}