vm.js 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getWindowsVm = exports.VmManager = void 0;
  4. const builder_util_1 = require("builder-util");
  5. const path = require("path");
  6. class VmManager {
  7. get pathSep() {
  8. return path.sep;
  9. }
  10. exec(file, args, options, isLogOutIfDebug = true) {
  11. return (0, builder_util_1.exec)(file, args, options, isLogOutIfDebug);
  12. }
  13. spawn(file, args, options, extraOptions) {
  14. return (0, builder_util_1.spawn)(file, args, options, extraOptions);
  15. }
  16. toVmFile(file) {
  17. return file;
  18. }
  19. }
  20. exports.VmManager = VmManager;
  21. async function getWindowsVm(debugLogger) {
  22. const parallelsVmModule = await Promise.resolve().then(() => require("./ParallelsVm"));
  23. const vmList = (await parallelsVmModule.parseVmList(debugLogger)).filter(it => ["win-10", "win-11"].includes(it.os));
  24. if (vmList.length === 0) {
  25. throw new builder_util_1.InvalidConfigurationError("Cannot find suitable Parallels Desktop virtual machine (Windows 10 is required)");
  26. }
  27. // prefer running or suspended vm
  28. return new parallelsVmModule.ParallelsVmManager(vmList.find(it => it.state === "running") || vmList.find(it => it.state === "suspended") || vmList[0]);
  29. }
  30. exports.getWindowsVm = getWindowsVm;
  31. //# sourceMappingURL=vm.js.map