Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Worker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,13 @@ public async static Task Main(string[] args)
}
});

// This must be done before the first Runspace is created, to avoid the creation of a thread by the upgrade checker
SetVersionUpgradeOptOut();

// Create the very first Runspace so the debugger has the target to attach to.
// This PowerShell instance is shared by the first PowerShellManager instance created in the pool,
// and the dependency manager (used to download dependent modules if needed).

var firstPowerShellInstance = Utils.NewPwshInstance();
var pwshVersion = Utils.GetPowerShellVersion(firstPowerShellInstance);
LogPowerShellVersion(pwshVersion);
Expand All @@ -101,6 +105,15 @@ public async static Task Main(string[] args)
await requestProcessor.ProcessRequestLoop();
}

private static void SetVersionUpgradeOptOut()
{
string checkForUpgrade = Environment.GetEnvironmentVariable("AZUREPS_CHECK_FOR_UPGRADE");
if (string.IsNullOrWhiteSpace(checkForUpgrade))
{
Environment.SetEnvironmentVariable("AZUREPS_CHECK_FOR_UPGRADE", "False");
}
}

// Warm up the PowerShell instance so that the subsequent function load and invocation requests are faster
private static void WarmUpPowerShell(System.Management.Automation.PowerShell firstPowerShellInstance)
{
Expand Down