How to use the cross-spawn/lib/util/resolveCommand function in cross-spawn

To help you get started, we’ve selected a few cross-spawn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github electron-userland / electron-forge / packages / maker / appx / src / MakerAppX.ts View on Github external
}
      const topDir = path.dirname(testPath);
      for (const subVersion of await fs.readdir(topDir)) {
        if (!(await fs.stat(path.resolve(topDir, subVersion))).isDirectory()) continue; // eslint-disable-line max-len, no-continue
        if (subVersion.substr(0, 2) !== '10') continue; // eslint-disable-line no-continue

        testExe = path.resolve(topDir, subVersion, 'x64', 'makecert.exe');
        if (await fs.pathExists(testExe)) {
          sdkTool = testExe;
          break;
        }
      }
    }
  }
  if (!sdkTool || !await fs.pathExists(sdkTool)) {
    sdkTool = resolveCommand({ command: exe, options: { cwd: null } }, true);
  }

  if (!sdkTool || !await fs.pathExists(sdkTool)) {
    throw new Error(`Can't find ${exe} in PATH. You probably need to install the Windows SDK.`);
  }

  return sdkTool;
}