Skip to content

Commit f57be20

Browse files
author
Kartik Raj
authored
Support powershell activation even if Powershell execution is disabled on the system (microsoft#22273)
Closes microsoft#22252 Error out if stderr is related to Powershell execution being disabled on system, even though environment variables are returned in this case, we've observed they're not valid in this case.
1 parent 802cf0c commit f57be20

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/client/interpreter/activation/service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,12 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
329329
}
330330
if (result.stderr) {
331331
if (returnedEnv) {
332-
traceWarn('Got env variables but with errors', result.stderr);
332+
traceWarn('Got env variables but with errors', result.stderr, returnedEnv);
333+
if (result.stderr.includes('running scripts is disabled')) {
334+
throw new Error(
335+
`Skipping returned result when powershell execution is disabled, stderr ${result.stderr} for ${command}`,
336+
);
337+
}
333338
} else {
334339
throw new Error(`StdErr from ShellExec, ${result.stderr} for ${command}`);
335340
}

0 commit comments

Comments
 (0)