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

Does not restore CWD correctly after task finishes #14

Open
cambirch opened this issue Sep 8, 2015 · 0 comments
Open

Does not restore CWD correctly after task finishes #14

cambirch opened this issue Sep 8, 2015 · 0 comments

Comments

@cambirch
Copy link

cambirch commented Sep 8, 2015

In my grunt process I use grunt.file.setBase("../") in order to include my entire repo in the grunt process.

The module uses setBase() to allow for computing adjustment base URLs, etc (understandable), but at the end it sets the base back to a stored base path of path.resolve('./') which may not actually be the original base path (it only MIGHT be if no setBase() was called after the module initialized).

This can be corrected by adding this line to the beginning of the multi-task:

var originalCWD = process.cwd();

and then replacing the grunt.file.setBase(gruntfileDir); at the end with:

grunt.file.setBase(originalCWD);

This ensures that any setBase called by the grunt setup process will be properly respected at the beginning and restored at the end of each task.

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