Skip to content

Contrary to what the documentation says, the current directory (location) is not inherited by the job #67

@Stevie-O

Description

@Stevie-O

Windows 10, Powershell 5.1.19041.1320

Import-Module ThreadJob -MinimumVersion 2.0.3

if (-not (test-path test-dir)) {
    mkdir test-dir | out-null
}
cd test-dir

Write-Host "Current directory: $(Get-Location)"

$job = Start-Job -ScriptBlock {  Write-Host "ThreadJob current directory: $(Get-Location)" }

Receive-Job $job -Wait -AutoRemoveJob

cd ..

Expected output:

Current directory: C:\Users\stevie-o\Documents\test-dir
ThreadJob current directory: C:\Users\stevie-o\Documents\test-dir

Actual output:

Current directory: C:\Users\stevie-o\Documents\test-dir
ThreadJob current directory: C:\Users\stevie-o\Documents

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions