mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-26 01:06:23 +02:00
fix: improve error handling in Docker installation script for Windows by using try-finally blocks
This commit is contained in:
parent
01f8a3ed80
commit
8238c56b3f
1 changed files with 12 additions and 2 deletions
|
|
@ -51,13 +51,23 @@ if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
|
|||
}
|
||||
Write-Ok "Docker found."
|
||||
|
||||
docker info *>$null
|
||||
try {
|
||||
$ErrorActionPreference = 'Continue'
|
||||
docker info *>$null
|
||||
} finally {
|
||||
$ErrorActionPreference = 'Stop'
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Err "Docker daemon is not running. Please start Docker Desktop and try again."
|
||||
}
|
||||
Write-Ok "Docker daemon is running."
|
||||
|
||||
docker compose version *>$null
|
||||
try {
|
||||
$ErrorActionPreference = 'Continue'
|
||||
docker compose version *>$null
|
||||
} finally {
|
||||
$ErrorActionPreference = 'Stop'
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Err "Docker Compose is not available. It should be bundled with Docker Desktop."
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue