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.
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.
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.
In any case, it should come back to default value on every end of each task. It's safer.
This is a good idea, but I'm going to close this for now, and possibly implement it in 0.5.
+1 This would be useful to me. Would you be receptive to a PR implementing this?