Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules run via npx issue with piped strings #39637

Closed
YodaDaCoda opened this issue Aug 3, 2021 · 1 comment
Closed

Modules run via npx issue with piped strings #39637

YodaDaCoda opened this issue Aug 3, 2021 · 1 comment

Comments

@YodaDaCoda
Copy link

Version

v15.5.0

Platform

Linux max 5.4.0-77-generic #86-Ubuntu SMP Thu Jun 17 02:35:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Create a file node_modules/.bin/testington with the following content:

#!/usr/bin/env node
console.log(process.argv[2]);

Execute it like the following:

echo 'test$param' | xargs -I'{}' npx testington '{}'

Note that it prints out test rather than test$param.

If you execute it like the following (i.e. setting the $param environment variable):

export param=asdf
echo 'test$param' | xargs -I'{}' npx testington '{}'

Note that it prints out testasdf.

How often does it reproduce? Is there a required condition?

Only occurs when run via npx, not when executed via node.

What is the expected behavior?

Environment variables should not be interpreted in piped strings.

What do you see instead?

Environment variables are interpreted, even though the piped strings are quoted appropriately.

Additional information

I've bisected this issue and it first appears in node v15.5.0. v15.4.0 and earlier are unaffected. Current v16.6.0 is still affected.

@YodaDaCoda
Copy link
Author

I didn't realise npx is part of npm/cli - will move this report to the appropriate repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant