Skip to content

Commit

Permalink
compatibility with pwsh (#3526)
Browse files Browse the repository at this point in the history
Using an empty string as parameter not works in pwsh.

**This code fails in PS7.x**
```powershell
$a = ""
docker ps $a
```

**This code works in PS5.x and PS7.x**
```powershell
$a = $null
docker ps $a
```
  • Loading branch information
lukas-pfeifhofer authored May 17, 2024
1 parent b68af9f commit a4e34ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ContainerInfo/Test-NavContainer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ try {
$id = ""
$a = "-a"
if ($doNotIncludeStoppedContainers) {
$a = ""
$a = $null
}

$id = docker ps $a --no-trunc --format "{{.ID}}/{{.Names}}" | Where-Object { $containerName -eq $_.split('/')[1] } | ForEach-Object { $_.split('/')[0] }
Expand Down

0 comments on commit a4e34ae

Please sign in to comment.