Improve comments

This commit is contained in:
Sander Declerck 2026-02-05 11:20:14 +01:00
parent 03d67d92be
commit 149a28e0dc
No known key found for this signature in database
3 changed files with 4 additions and 5 deletions

View file

@ -259,8 +259,9 @@ export async function validatePowerShellExecutionPolicy(shellExecutableName) {
try { try {
// For Windows PowerShell (5.1), clean PSModulePath to avoid conflicts with PowerShell 7 modules // For Windows PowerShell (5.1), clean PSModulePath to avoid conflicts with PowerShell 7 modules
// When PowerShell 7 is installed, it adds its module paths to PSModulePath, causing // When safe-chain is invoked from PowerShell 7, it sets its module paths to PSModulePath, causing
// Windows PowerShell to try loading incompatible PowerShell 7 modules (TypeData conflicts) // Windows PowerShell to try loading incompatible PowerShell 7 modules.
// Setting the environment to Windows PowerShell's modules fixes this.
let spawnOptions; let spawnOptions;
if (shellExecutableName === "powershell") { if (shellExecutableName === "powershell") {
const userProfile = process.env.USERPROFILE || ""; const userProfile = process.env.USERPROFILE || "";
@ -283,7 +284,7 @@ export async function validatePowerShellExecutionPolicy(shellExecutableName) {
const commandResult = await safeSpawn( const commandResult = await safeSpawn(
shellExecutableName, shellExecutableName,
["-Command", "Get-ExecutionPolicy"], ["-Command", "Get-ExecutionPolicy"],
spawnOptions spawnOptions,
); );
const policy = commandResult.stdout.trim(); const policy = commandResult.stdout.trim();

View file

@ -40,7 +40,6 @@ function teardown(tools) {
} }
async function setup() { async function setup() {
// Check execution policy
const { isValid, policy } = const { isValid, policy } =
await validatePowerShellExecutionPolicy(executableName); await validatePowerShellExecutionPolicy(executableName);
if (!isValid) { if (!isValid) {

View file

@ -40,7 +40,6 @@ function teardown(tools) {
} }
async function setup() { async function setup() {
// Check execution policy
const { isValid, policy } = const { isValid, policy } =
await validatePowerShellExecutionPolicy(executableName); await validatePowerShellExecutionPolicy(executableName);
if (!isValid) { if (!isValid) {