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

Reset the cwd after each task run in case a plugin mistakenly changes it #493

Closed
shama opened this issue Oct 23, 2012 · 5 comments
Closed
Labels

Comments

@shama
Copy link
Member

shama commented Oct 23, 2012

Ref #492

Also sometimes a plugin author might use a lib that changes the cwd without their knowledge. Bad practice but I'm sure it will happen.

@cowboy
Copy link
Member

cowboy commented Oct 23, 2012

What happens if someone wants to write a task that changes the cwd? Is there actually a use-case for changing the cwd?

Maybe we should remove grunt.file.setBase and the user can use process.chdir themself if they need it.

Also, grunt could do a debug log of the cwd when running a task. It already logs the file the task lives in. We could probably log a lot more debugging information before/after running tasks.

@shama
Copy link
Member Author

shama commented Oct 23, 2012

Tasks can change the cwd and even though a bad practice, it's okay, imo.

I don't think there is a valid use case for a task to change the cwd for other tasks though. Having other tasks rely on another task to change the cwd seems like a bad idea; one this issue is aimed to fix.

@kud
Copy link

kud commented Oct 24, 2012

In any case, it should come back to default value on every end of each task. It's safer.

@cowboy
Copy link
Member

cowboy commented Dec 31, 2012

This is a good idea, but I'm going to close this for now, and possibly implement it in 0.5.

@NickHeiner
Copy link

+1 This would be useful to me. Would you be receptive to a PR implementing this?

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

4 participants