Skip to content

Commit

Permalink
Merge pull request #2837 from freddydk/master
Browse files Browse the repository at this point in the history
Issue #2813
  • Loading branch information
freddydk committed Dec 27, 2022
2 parents abedf6f + 4641adc commit d909f75
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
7 changes: 4 additions & 3 deletions AppHandling/Sort-AppFilesByDependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ try {
$appJson = Invoke-ScriptInBcContainer -containerName $containerName -scriptblock { Param($appFile)
Get-NavAppInfo -Path $appFile | ConvertTo-Json -Depth 99
} -argumentList (Get-BcContainerPath -containerName $containerName -path $destFile) | ConvertFrom-Json
#Remove-Item -Path $destFile
Remove-Item -Path $destFile
$appJson.Version = "$($appJson.Version.Major).$($appJson.Version.Minor).$($appJson.Version.Build).$($appJson.Version.Revision)"
$appJson | Add-Member -NotePropertyName 'Id' -NotePropertyValue $appJson.AppId.Value
if ($appJson.Dependencies) {
$appJson.Dependencies | % { if ($_) {
$appJson.Dependencies | ForEach-Object { if ($_) {
$_ | Add-Member -NotePropertyName 'Id' -NotePropertyValue $_.AppId
$_ | Add-Member -NotePropertyName 'Version' -NotePropertyValue $_.MinVersion.ToString()
$_ | Add-Member -NotePropertyName 'Version' -NotePropertyValue "$($_.MinVersion.Major).$($_.MinVersion.Minor).$($_.MinVersion.Build).$($_.MinVersion.Revision)"
} }
}
}
Expand Down
4 changes: 3 additions & 1 deletion Common/Invoke-gh.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#>
function invoke-gh {
Param(
[parameter(mandatory = $false, ValueFromPipeline = $true)]
[string] $inputStr = "",
[switch] $silent,
[switch] $returnValue,
[parameter(mandatory = $true, position = 0)][string] $command,
Expand All @@ -21,7 +23,7 @@ function invoke-gh {
$arguments += "$_ "
}
}
cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue
cmdDo -command gh -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr
}

Export-ModuleMember -Function Invoke-gh
4 changes: 3 additions & 1 deletion Common/Invoke-git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#>
function invoke-git {
Param(
[parameter(mandatory = $false, ValueFromPipeline = $true)]
[string] $inputStr = "",
[switch] $silent,
[switch] $returnValue,
[parameter(mandatory = $true, position = 0)][string] $command,
Expand All @@ -21,6 +23,6 @@ function invoke-git {
$arguments += "$_ "
}
}
cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue
cmdDo -command git -arguments $arguments -silent:$silent -returnValue:$returnValue -inputStr $inputStr
}
Export-ModuleMember -Function Invoke-git
11 changes: 9 additions & 2 deletions HelperFunctions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ function CmdDo {
[string] $command = "",
[string] $arguments = "",
[switch] $silent,
[switch] $returnValue
[switch] $returnValue,
[string] $inputStr = ""
)

$oldNoColor = "$env:NO_COLOR"
Expand All @@ -88,6 +89,9 @@ function CmdDo {
$pinfo.FileName = $command
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
if ($inputStr) {
$pinfo.RedirectStandardInput = $true
}
$pinfo.WorkingDirectory = Get-Location
$pinfo.UseShellExecute = $false
$pinfo.Arguments = $arguments
Expand All @@ -96,7 +100,10 @@ function CmdDo {
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null

if ($inputStr) {
$p.StandardInput.WriteLine($inputStr)
$p.StandardInput.Close()
}
$outtask = $p.StandardOutput.ReadToEndAsync()
$errtask = $p.StandardError.ReadToEndAsync()
$p.WaitForExit();
Expand Down

0 comments on commit d909f75

Please sign in to comment.