effect icon indicating copy to clipboard operation
effect copied to clipboard

handle executable paths with spaces in CLI arguments, close #5845

Open Masty88 opened this issue 4 weeks ago • 2 comments

Type

  • [x] Bug Fix

Description

Fixes executable path splitting when paths contain spaces (e.g., C:\Program Files\nodejs\node.exe on Windows or /usr/local/My Programs/node on Unix-like systems).

Instead of using executable.split(/\s+/) which breaks any path with spaces, we now extract runtime and script directly from the original args array using Arr.take(originalArgs, 2).

Changes:

  • Modified handleBuiltInOption() to accept originalArgs parameter
  • Fixed SetLogLevel case to preserve paths with spaces when re-executing commands
  • Fixed ShowWizard case to preserve paths with spaces when running wizard-constructed commands
  • Added helper function getExecutableArgs() to extract runtime and script from original args
  • Added test case for executable paths with spaces in CliApp.test.ts

Test plan:

  • ✅ All existing 146 tests pass
  • ✅ Added new test for executable paths with spaces
  • ✅ Manually tested with minigit example: npx tsx examples/minigit.ts --log-level info -c test=value clone https://github.com/test/repo

Related

  • Closes #5845

Masty88 avatar Dec 03 '25 08:12 Masty88

🦋 Changeset detected

Latest commit: d68996ce151be94bc5e8554f5f1284a78edd0e97

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Dec 03 '25 08:12 changeset-bot[bot]

@kitlangton can you please review?

IMax153 avatar Dec 12 '25 16:12 IMax153