I want to run a command and let user interact afterwards. Example, if i run npm init, the user should be able to give project name, description and all.. My current code just run the command and logs the output and terminates
My code:
require('shelljs/global'); //npm/shelljs
var child = exec('npm initda', {async:true});
child.stdout.on('data', function(data) {
console.log(data)
});
Output:
This utility will walk you through creating a package.json file. It only covers the most common items, and tries to guess sensible defaults.
See
npm help initfor definitive documentation on these fields and exactly what they do.Use
npm install <pkg>afterwards to install a package and save it as a dependency in the package.json file.Press ^C at any time to quit. package name: (so-example)
Thanks in advance [this is not a duplicate question, it may look simmilar to my previos question :) ]