gruntjs / gruntjs/grunt

Don't use `process.chdir()`

Open
#1,147 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

Since Grunt can also be used via its API, I would suggest avoiding `process.chdir`.

One problem is if Grunt is used inside an [Express](http://expressjs.com) app as views expects `process.cwd` to be the root of the app folder.

Another problem is if I want to run several Grunt files in parallel. Spawning is expensive.

With [Bower](http://bower.io) it is possible to set the working dir with `bower.config.cwd = 'otherfolder'`. Something like that would be great with Grunt.

I'm using the Grunt API as I'm building a service that runs a repositorys Bower, Grunt etc when changes have been made in the master branch.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Grunt's API entry points and locating where process.chdir() is used. Define how an API-configurable working directory should behave for Express integration and parallel Grunt files; done means callers can set that directory without changing the host process's global working directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.