Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ protected override void BeginProcessing()
else
{
// Working Directory not specified -> Assign Current Path.
startInfo.WorkingDirectory = ResolveFilePath(this.SessionState.Path.CurrentFileSystemLocation.Path);
startInfo.WorkingDirectory = PathUtils.ResolveFilePath(this.SessionState.Path.CurrentFileSystemLocation.Path, this, isLiteralPath: true);
}

if (this.ParameterSetName.Equals("Default"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Describe "Start-Process" -Tag "Feature","RequireAdminOnWindows" {
$pingCommand = (Get-Command -CommandType Application ping)[0].Definition
$pingDirectory = Split-Path $pingCommand -Parent
$tempFile = Join-Path -Path $TestDrive -ChildPath PSTest
$tempDirectory = Join-Path -Path $TestDrive -ChildPath 'PSPath[]'
New-Item $tempDirectory -ItemType Directory -Force
$assetsFile = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath SortTest.txt
if ($IsWindows) {
$pingParam = "-n 2 localhost"
Expand Down Expand Up @@ -68,6 +70,15 @@ Describe "Start-Process" -Tag "Feature","RequireAdminOnWindows" {
$process.Id | Should -BeGreaterThan 1
# $process.ProcessName | Should -Be "ping"
}

It "Should work correctly within an unspecified WorkingDirectory with wildcard-type characters" {
Push-Location -LiteralPath $tempDirectory
$process = Start-Process ping -ArgumentList $pingParam -PassThru -RedirectStandardOutput "$TESTDRIVE/output" @extraArgs
$process.Length | Should -Be 1
$process.Id | Should -BeGreaterThan 1
# $process.ProcessName | Should -Be "ping"
Pop-Location
}

It "Should handle stderr redirection without error" {
$process = Start-Process ping -ArgumentList $pingParam -PassThru -RedirectStandardError $tempFile -RedirectStandardOutput "$TESTDRIVE/output" @extraArgs
Expand Down