Skip to content

& background invocation operator should -WorkingDirectory when starting a job #10515

@adityapatwardhan

Description

@adityapatwardhan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Hacktoberfest-AcceptedAccepted to participate in HacktoberfestIssue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityResolution-FixedThe issue is fixed.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions