Skip to content

Command with caret doesn't work as supposed to with exec() #1015

@Friksel

Description

@Friksel

Node version (or tell us if you're using electron or some other framework):

14.15.3

ShellJS version (the most recent version/Github branch you see the bug on):

0.8.4

Operating system:

Windows 10

Description of the bug:

Executing a command with a caret, like pnpm install three@^0.124.0, isn't working; instead of running that command it seems to run the command without the caret under the hood, which has a different outcome as it's not installing v0.124.0 or higher, but installes exactly v0.124.0. So the caret in this case is important and may never be stripped.

I tried escaping the caret with \, but that didn't help.

Looking in the shellJS module I can't find code where it strips the ^ and I see the command passing through just fine. So not shure what's going on exactly, but when running the command directly in a command line tool, like powershell, it just works as expected.

Example ShellJS command to reproduce the error:

const result = shell.exec('pnpm install three@^0.124.0'); // seems to execute command without caret

Metadata

Metadata

Assignees

No one assigned

    Labels

    WindowsexecIssues specific to the shell.exec() APIwontfix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions