-
Notifications
You must be signed in to change notification settings - Fork 846
Description
Is your feature request related to a problem? Please describe.
Currently with this code works that spawn a process internally that depends on node child_process:
cp8.execFile(
goRuntimePath,
// -json is supported since go1.9
["env", "-json", "GOPATH", "GOROOT", "GOPROXY", "GOBIN", "GOMODCACHE"],
{ env: env3, cwd },
(err, stdout, stderr) => {
if (err) {
outputChannel.info(
`Failed to run '${goRuntimePath} env' (cwd: ${getWorkspaceFolderPath()}): ${err}
${stderr}`
);
outputChannel.show();
vscode14.window.showErrorMessage(
`Failed to run '${goRuntimePath} env. The config change may not be applied correctly.`
);
return reject();
}
if (stderr) {
outputChannel.info(`'${goRuntimePath} env': ${stderr}`);
outputChannel.show();
}
outputChannel.trace(`${goRuntimePath} env ...:
${stdout}`);
const envOutput = JSON.parse(stdout);
if (envOutput.GOROOT && envOutput.GOROOT.trim()) {
outputChannel.debug("setCurrentGOROOT:", envOutput.GOROOT);
setCurrentGoRoot(envOutput.GOROOT.trim());
delete envOutput.GOROOT;
}
for (const envName in envOutput) {
if (!process.env[envName] && envOutput[envName] && envOutput[envName].trim()) {
process.env[envName] = envOutput[envName].trim();
}
}
if (why !== "path") {
addGoRuntimeBaseToPATH(path6.join(getCurrentGoRoot(), "bin"));
} else {
clearGoRuntimeBaseFromPATH();
}
initGoStatusBar(goCtx2);
return resolve();
}
);As https://stackoverflow.com/questions/78420489/error-when-running-npm-script-with-yarn-err-spawn-einval states, if go.cmd is passed, it will throws EINTVAL, and go.ps1 will causes Uncaught Error: spawn EFTYPE.
Describe the solution you'd like
Allows an option to make {"shell": true} for such case. This is necessary since the popularize of tools like https://github.com/jdx/mise that use shims technique heavily to substitute for real go.exe (which is usually achieved through go.cmd and similar).
Describe alternatives you've considered
No current alternative solution so far, but I did consider making a small C wrapper program to bypass this but it's annoying.