-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature] Add "$PWD" shell evaluation #1804
Comments
I believe this would just require changing: The |
While I don't have a super strong feeling against |
I agree that |
That sounds reasonable 👍 |
I'd love to add OLDPWD, however I'm not sure how I'd accomplish that in a non-bash environment? How can I know what the last known working directory was in NodeJS? |
@yinzara The shell has a state which contains the |
Technically PWD and OLDPWD aren't magical at all (contrary to RANDOM, for instance, which has a special resolution logic) - it's just that they both get set in the env each time you call the
|
I could modify the yarn shell to initialize both the OLDPWD and PWD environment variables to process.cwd() when it starts then modify the environment variables in the "cd" builtin. If I was within the Yarn shell for the entirety of my execution this wouldn't be an issue, however if one of the main use of yarn shell is to execute scripts from a package.json, I would expect that $OLDPWD would work within a script giving me the working directory of the last directory working directory I was in when I executed the package script. However given the above implementation, if I evaluated Thoughts? |
Describe the user story
Describe the solution you'd like
Modify yarnpkg-shell to have a special case variable replacement of "PWD" to the current working directory (i.e.
process.cwd()
).Describe the drawbacks of your solution
If a user was using PWD as an environment variable to mean something else, this could break that use case but since the primary case of the Yarn shell is to replicate bash (which reserves that environment variable) the risk is very low.
Describe alternatives you've considered
Using the
cross-env
package with '$PWD' escaped in single quotesThe text was updated successfully, but these errors were encountered: