Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

[Bug] stderr output suppressed on shell script shim

Open sitiom opened this issue 1 year ago • 1 comments

Bug Report

The .cmd shim created by Scoop has a 2>nul redirect at the end which suppresses stderr output, breaking behavior on most scripts (https://github.com/ScoopInstaller/Main/pull/6090#pullrequestreview-2231325689, https://github.com/ScoopInstaller/Main/pull/6117#pullrequestreview-2244891697). Example shim from neofetch: image

Example command for reproduction: neofetch -v

Current Behavior

Error messages are not shown (called from the .cmd shim on PowerShell) image

Expected Behavior

Error messages should be shown (Example from bash) image

Additional context/output

It used to be working before, and the regression was introduced in https://github.com/ScoopInstaller/Scoop/commit/a9ca75c0cda0ab9f2b683f972dc4a2c65d1b1cd0.

Possible Solution

Perhaps a proper check of the wslpath and cygpath command first should work:

@rem C:\Users\rycae\scoop\apps\wcurl\current\wcurl
@echo off
bash -c "command -v wslpath >/dev/null"
if %errorlevel% equ 0 (
  bash "$(wslpath -u 'C:\Users\rycae\scoop\apps\wcurl\current\wcurl')"  %*
) else (
  set args= %*
  setlocal enabledelayedexpansion
  if not "!args!"=="" set args=!args:"=""!
  bash -c "$(cygpath -u 'C:\Users\rycae\scoop\apps\wcurl\current\wcurl') !args!"
)

System details

Windows version: 11

OS architecture: 32bit, 64bit

PowerShell version: 7.4.4

Additional software: WSL, Git

Scoop Configuration

{
    "aria2-warning-enabled":  false,
    "last_update":  "2024-08-19T15:35:17.7825723+08:00",
    "scoop_branch":  "master",
    "scoop_repo":  "https://github.com/ScoopInstaller/Scoop"
}

sitiom avatar Aug 19 '24 07:08 sitiom

Any updates on this?

maherm avatar Sep 06 '24 10:09 maherm