Skip to content

Fails to install to a path with spaces #21

@koterpillar

Description

@koterpillar

When the package is added to a project that has spaces in the path, it fails to install:

$ yarn add cloudflared
yarn add v1.22.22
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
error /<snip>/test spaces/node_modules/cloudflared: Command failed.
Exit code: 127
Command: node scripts/postinstall.mjs && node lib/cloudflared.js -v
Arguments: 
Directory: /<snip>/test spaces/node_modules/cloudflared
Output:
Installed cloudflared to /<snip>/test spaces/node_modules/cloudflared/bin/cloudflared
/bin/sh: /<snip>/test: No such file or directory
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

I have traced it to the line:

const sub = spawn(bin, args, { shell: true, stdio: "inherit" });

Is there a reason shell: true is needed there? Works fine without it in my tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions