Skip to content

Commit

Permalink
Support powershell activation even if Powershell execution is disable…
Browse files Browse the repository at this point in the history
…d on the system (#22273)

Closes #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.
  • Loading branch information
Kartik Raj authored Oct 20, 2023
1 parent 802cf0c commit f57be20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/client/interpreter/activation/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,12 @@ export class EnvironmentActivationService implements IEnvironmentActivationServi
}
if (result.stderr) {
if (returnedEnv) {
traceWarn('Got env variables but with errors', result.stderr);
traceWarn('Got env variables but with errors', result.stderr, returnedEnv);
if (result.stderr.includes('running scripts is disabled')) {
throw new Error(
`Skipping returned result when powershell execution is disabled, stderr ${result.stderr} for ${command}`,
);
}
} else {
throw new Error(`StdErr from ShellExec, ${result.stderr} for ${command}`);
}
Expand Down

0 comments on commit f57be20

Please sign in to comment.