Skip to content

[Bug]: VS Code preinstall redownloads an existing icon on Windows #1756

Description

@dajiaohuang

Version

System:
  OS: Microsoft Windows 10 Pro N 10.0.19045 (64-bit)
  Node: v24.14.1
  pnpm: 11.24.0
  Rstest repository: 95172d0ac0266025d9f03926ad2834a54e585c22 (main)

Details

The VS Code package's preinstall script uses the POSIX expression [ -f icon.png ] as its existence guard. pnpm runs that script through cmd.exe on Windows, where [ is not a command. The failed guard therefore reaches the curl fallback and downloads the 28,214-byte icon on every install, even when packages/vscode/icon.png already exists.

Expected behavior: an existing icon should make the preinstall step a no-op.

Actual output includes:

packages/vscode preinstall: '[' is not recognized as an internal or external command,
packages/vscode preinstall: operable program or batch file.
packages/vscode preinstall: 100 28214  100 28214

This creates an unnecessary CDN dependency for normal Windows workspace installation.

Reproduce link

"preinstall": "[ -f icon.png ] || curl https://assets.rspack.rs/rstest/rstest-logo-512x512.png --output icon.png",

Reproduce Steps

  1. Clone the repository on Windows and check out main.
  2. Ensure packages/vscode/icon.png exists (a prior install creates it).
  3. Run pnpm install --frozen-lockfile.
  4. Observe that the POSIX guard fails and curl downloads the icon again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions