( scriptName, platform = process.platform, env = process.env, nodeExecPath = process.execPath, )
| 730 | export { buildRuntimeServicesInfo }; |
| 731 | |
| 732 | export function buildNpmScriptCommand( |
| 733 | scriptName, |
| 734 | platform = process.platform, |
| 735 | env = process.env, |
| 736 | nodeExecPath = process.execPath, |
| 737 | ) { |
| 738 | // On Windows, always use cmd.exe regardless of whether npm_execpath is set. |
| 739 | // npm_execpath points to a path like |
| 740 | // "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" which contains |
| 741 | // spaces. When that path is passed as an argument with shell:true in |
| 742 | // spawnService, cmd.exe splits on the space and tries to run "C:\Program" |
| 743 | // as a command, producing "not recognized as an internal or external command". |
| 744 | // Using "npm" via cmd.exe avoids the problem entirely. |
| 745 | if (platform === "win32") { |
| 746 | return { |
| 747 | command: env.ComSpec || "cmd.exe", |
| 748 | args: ["/d", "/s", "/c", "npm", "run", scriptName], |
| 749 | }; |
| 750 | } |
| 751 | |
| 752 | if (env.npm_execpath) { |
| 753 | return { |
| 754 | command: env.npm_node_execpath || nodeExecPath, |
| 755 | args: [env.npm_execpath, "run", scriptName], |
| 756 | }; |
| 757 | } |
| 758 | |
| 759 | return { |
| 760 | command: "npm", |
| 761 | args: ["run", scriptName], |
| 762 | }; |
| 763 | } |
| 764 | |
| 765 | export function validateLocalAgentServerPath(localPath) { |
| 766 | if (!path.isAbsolute(localPath)) { |
no outgoing calls
no test coverage detected