Skip to content

Commit a6abc16

Browse files
author
devizer
committed
Fix Run-Remote-Script if runner contains space [skip ci]
1 parent 41abaad commit a6abc16

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

Install-SqlServer-Version-Management.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Param(
44
)
55

66
$ModuleName = 'SqlServer-Version-Management';
7-
$ModuleVersion = '2.1.185';
7+
$ModuleVersion = '2.1.186';
88
$ModuleFiles = @(
99
@{
1010
FileName = 'SqlServer-Version-Management\SqlServer-Version-Management.psd1';
@@ -15,7 +15,7 @@ $ModuleFiles = @(
1515
" ModuleToProcess = @('SqlServer-Version-Management.psm1')",
1616
"",
1717
" # Version below is automatically incremented on build",
18-
" ModuleVersion = `"2.1.185`"",
18+
" ModuleVersion = `"2.1.186`"",
1919
"",
2020
" GUID = 'dd03b53d-575a-4056-ae08-e6dfea3384ea'",
2121
"",
@@ -1776,9 +1776,13 @@ $ModuleFiles = @(
17761776
" `$okDownload = Download-File-Managed `"`$url`" `"`$fileFullName`"",
17771777
" # Write-Host `"okDownload: `$okDownload`"",
17781778
" if (`$okDownload) {",
1779-
" `$allWorld = `$runner.Split(`" `") + @(`$runnerParameter) + @(`$fileFullName) + `$passthrowArgs;",
1780-
" `$allWorld = @(`$allWorld | ? { `"`$_`" })",
1781-
" & `$allWorld[0] @(`$allWorld | Select-Object -Skip 1) | Out-Host",
1779+
" `$a=@(`$runnerParameter, `$fileFullName) + @(`$passthrowArgs)",
1780+
" `$a=@(`$a | ? { `"`$_`" })",
1781+
" & `"`$runner`" @(`$a)",
1782+
" # Incorrect version if `$runner contains space",
1783+
" # `$allWorld = `$runner.Split(`" `") + @(`$runnerParameter) + @(`$fileFullName) + `$passthrowArgs;",
1784+
" # `$allWorld = @(`$allWorld | ? { `"`$_`" })",
1785+
" # & `$allWorld[0] @(`$allWorld | Select-Object -Skip 1) | Out-Host",
17821786
" if (-not `$?) {",
17831787
" Write-Line -TextRed `"Run-Remote-Script FAIL: '`$url'`"",
17841788
" }",

SqlServer-Version-Management.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,9 +1643,13 @@ function Run-Remote-Script() {
16431643
$okDownload = Download-File-Managed "$url" "$fileFullName"
16441644
# Write-Host "okDownload: $okDownload"
16451645
if ($okDownload) {
1646-
$allWorld = $runner.Split(" ") + @($runnerParameter) + @($fileFullName) + $passthrowArgs;
1647-
$allWorld = @($allWorld | ? { "$_" })
1648-
& $allWorld[0] @($allWorld | Select-Object -Skip 1) | Out-Host
1646+
$a=@($runnerParameter, $fileFullName) + @($passthrowArgs)
1647+
$a=@($a | ? { "$_" })
1648+
& "$runner" @($a)
1649+
# Incorrect version if $runner contains space
1650+
# $allWorld = $runner.Split(" ") + @($runnerParameter) + @($fileFullName) + $passthrowArgs;
1651+
# $allWorld = @($allWorld | ? { "$_" })
1652+
# & $allWorld[0] @($allWorld | Select-Object -Skip 1) | Out-Host
16491653
if (-not $?) {
16501654
Write-Line -TextRed "Run-Remote-Script FAIL: '$url'"
16511655
}

0 commit comments

Comments
 (0)