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

run command does not set INIT_CWD environment variable #5698

Closed
bradchoate opened this issue Apr 18, 2018 · 5 comments
Closed

run command does not set INIT_CWD environment variable #5698

bradchoate opened this issue Apr 18, 2018 · 5 comments
Assignees
Labels

Comments

@bradchoate
Copy link

Do you want to request a feature or report a bug?

Feature parity request, but could be considered a bug too.

What is the current behavior?
The npm run command sets an environment variable-- INIT_CWD which is not set by yarn, and one of our dependencies appears to rely on this variable being assigned. This variable is documented for npm here.

If the current behavior is a bug, please provide the steps to reproduce.

I don't have a repo, but if you add a "env" command to package.json and run it via "npm run env" and "yarn run env", you'll see that npm sets INIT_CWD where yarn does not.

What is the expected behavior?
INIT_CWD should be set to the current path in context of the 'run' command (this applies for any dependencies' scripts, such as postinstall scripts).

Please mention your node.js, yarn and operating system version.
node v8.10.0, macOS 10.13.4

@ghost ghost assigned torifat Apr 18, 2018
@ghost ghost added the triaged label Apr 18, 2018
@bradchoate
Copy link
Author

I found the pull request that implemented this for npm.

@generalov
Copy link

It seems that this is implemented in PR #5656.

@aprilandjan
Copy link

Yeah my yarn v1.19.2 seems already support this

@dimkir
Copy link

dimkir commented Dec 1, 2019

@aprilandjan i just upgraded yarn from v1.13.0 (yarn -v) via npm -g upgrade yarn and now I have v1.19.2 and it supports $INIT_CWD eg.

  "scripts": {
    "prestart": "echo Prestart in $INIT_CWD ...",

@paul-soporan
Copy link
Member

Closing as this has been implemented.

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

No branches or pull requests

6 participants