PR #10324 is merged and now we can use -WorkingDirectory when starting a job for background invocation operator.
The following code can be replaced:
|
const string cmdPrefix = @"Microsoft.PowerShell.Management\Set-Location -LiteralPath $using:pwd ; "; |
|
// Minimize allocations by initializing the stringbuilder to the size of the source string + prefix + space for ${using:} * 2 |
|
System.Text.StringBuilder updatedScriptblock = new System.Text.StringBuilder(cmdPrefix.Length + scriptblockBodyString.Length + 18); |
|
updatedScriptblock.Append(cmdPrefix); |
Steps to reproduce
Expected behavior
Actual behavior
Environment data
Name Value
---- -----
PSVersion 7.0.0-daily.20190906
PSEdition Core
GitCommitId 7.0.0-daily.20190906
OS Microsoft Windows 10.0.18978
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PR #10324 is merged and now we can use
-WorkingDirectorywhen starting a job for background invocation operator.The following code can be replaced:
PowerShell/src/System.Management.Automation/engine/runtime/Operations/MiscOps.cs
Lines 529 to 532 in f69f30b
Steps to reproduce
Expected behavior
Actual behavior
Environment data