This commit is contained in:
2026-05-16 20:35:37 -05:00
parent a84fc8fdc9
commit e09f8402d5
3 changed files with 99 additions and 2 deletions
+3 -2
View File
@@ -51,10 +51,11 @@ function Download-YTDLP {
}
# 1. Execute yt-dlp using the call operator (&) and passing the arguments array (@)
& $ytDlpPath $arguments
$output = & $ytDlpPath @arguments 2>&1
$exitCode = $LASTEXITCODE
# 2. CRITICAL: Check the Exit Code immediately after execution
if ($LASTEXITCODE -ne 0) {
if ($exitCode -ne 0) {
# If the exit code is not 0, we throw a terminating exception.
# This exception will be caught by your external try/catch block!
$ErrorMessage = "yt-dlp failed (Exit Code: $($LASTEXITCODE)). Check standard error output for details."