ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
21.33k stars 1.41k forks source link

[Bug] scoop commands does not return errort code on Git bash #6228

Open xudyang1 opened 1 week ago

xudyang1 commented 1 week ago

Bug Report

Current Behavior

  1. open git bash
  2. run scoop prefix unknown_package
  3. outputs read message Could not find app path for 'unknown_package'.
  4. check exit code echo $? is 0. That means the above red message is written to stdout instead of stderr.

Expected Behavior

The exit code should be 1 (as in pwsh, $LASTEXITCODE is 1)

Additional context/output

Scoop scripts uses abort "msg..." to write error output, but when I test it with a local .ps1 script, it reports

The term 'abort' is not recognized as a name of a cmdlet,
 function, script file, or executable program. Check the
 spelling of the name, or if a path was included, verify
 that the path is correct and try again.

Possible Solution

use throw or Write-Error "msg..." with exit 1, or keep using abort "msg..." and then add exit 1 after it?

System details

Windows version: [e.g. 7, 8, 10, 11] 10

OS architecture: [e.g. 32bit, 64bit, arm64] 64bit

PowerShell version: [output of "$($PSVersionTable.PSVersion)"] 7.4.6

Additional software: [(optional) e.g. ConEmu, Git] Git bash: downloaded by scoop install git, version git version 2.45.2.windows.1

Scoop Configuration

{
  "last_update": "2024-11-11T00:10:49.2099138-05:00",
  "scoop_repo": "https://github.com/ScoopInstaller/Scoop",
  "scoop_branch": "master"
}
xudyang1 commented 1 week ago

Related #2032