Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting background job in a UNC path with & returns error #18618

Closed
5 tasks done
johanringman opened this issue Nov 19, 2022 · 3 comments · Fixed by #18675
Closed
5 tasks done

Starting background job in a UNC path with & returns error #18618

johanringman opened this issue Nov 19, 2022 · 3 comments · Fixed by #18675
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.

Comments

@johanringman
Copy link

johanringman commented Nov 19, 2022

Prerequisites

Steps to reproduce

Since Powershell 7.3 i can't start a background job via the & shorthand with an UNC path as working directory.
It's working fine when using Start-Job { }.

Expected behavior

PS Microsoft.PowerShell.Core\FileSystem::\\localhost\Share> $null &

Id     Name            PSJobTypeName   State         HasMoreData     Location             Command
--     ----            -------------   -----         -----------     --------             -------
1      Job1            BackgroundJob   Running       True            localhost            Microsoft.PowerShell.Man…

Actual behavior

PS Microsoft.PowerShell.Core\FileSystem::\\localhost\Share> $null &
Start-Job: Cannot find the WorkingDirectory path Microsoft.PowerShell.Core\FileSystem::\\localhost\Share.

Error details

Exception             :
    Type       : System.IO.DirectoryNotFoundException
    TargetSite :
        Name          : ThrowTerminatingError
        DeclaringType : System.Management.Automation.MshCommandRuntime, System.Management.Automation, Version=7.3.0.500, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
        MemberType    : Method
        Module        : System.Management.Automation.dll
    Message    : Cannot find the WorkingDirectory path Microsoft.PowerShell.Core\FileSystem::\\localhost\Share.
    Source     : System.Management.Automation
    HResult    : -2147024893
    StackTrace :
   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
CategoryInfo          : InvalidOperation: (:) [Start-Job], DirectoryNotFoundException
FullyQualifiedErrorId : DirectoryNotFoundException,Microsoft.PowerShell.Commands.StartJobCommand
InvocationInfo        :
    MyCommand        : Start-Job
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : -1
    Line             : $null &
    PositionMessage  : At line:1 char:1
                       + $null &
                       + ~~~~~
    InvocationName   : Start-Job
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

Environment data

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

Powershell 7 3

Powershell 7 2

@johanringman johanringman added the Needs-Triage The issue is new and needs to be triaged by a work group. label Nov 19, 2022
@mklement0
Copy link
Contributor

The problem was also present in 7.3.0-rc.1 - don't know when it started.

It only affects the postpositional & syntax for starting background jobs - Start-Job { "Hi from $PWD" } works fine, for instance.

@mklement0

This comment was marked as resolved.

@johanringman johanringman changed the title Starting backround job in a UNC path with & returns error Starting background job in a UNC path with & returns error Nov 21, 2022
@ghost ghost added the In-PR Indicates that a PR is out for the issue label Nov 28, 2022
@daxian-dbw daxian-dbw added Issue-Bug Issue has been identified as a bug in the product and removed Needs-Triage The issue is new and needs to be triaged by a work group. labels Nov 28, 2022
@daxian-dbw
Copy link
Member

This is a regression introduced by #16180, but the real bug is in Start-Job -WorkingDirectory.

@ghost ghost added Resolution-Fixed The issue is fixed. and removed In-PR Indicates that a PR is out for the issue labels Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.
Projects
None yet
4 participants