user3957728
user3957728

Reputation:

Run command in particular directory with NodeJS

I am building a desktop app in HTML, CSS and typescript with Brackets core. My question is: is it possible to run a command with Node.js? I want to go to CD into a directory and then run grunt serve.

I have searched Google and the Node site, but couldn't find anything.

Thanks you

Sven

Upvotes: 6

Views: 7323

Answers (1)

jysperm
jysperm

Reputation: 216

http://nodejs.org/api/child_process.html

child_process.exec('shell command', {cwd: 'current work dir'}, function(err, stdout, stderr) {});

Upvotes: 11

Related Questions