O nodeJS exec não funciona para o cmd do shell “cd”
var sys = require('sys'),
exec = require('child_process').exec;
exec("cd /home/ubuntu/distro", function(err, stdout, stderr) {
console.log("cd: " + err + " : " + stdout);
exec("pwd", function(err, stdout, stderr) {
console.log("pwd: " + err + " : " + stdout);
exec("git status", function(err, stdout, stderr) {
console.log("git status returned " ); console.log(err);
})
})
})
cd: null :
pwd: null : /
git status returned
{ [Error: Command failed: fatal: Not a git repository (or any of the parent directories): .git ] killed: false, code: 128, signal: null }
O nodeJS exec não funciona para o cmd do shell "cd". como você vê abaixo, o pwd funciona, o git status está tentando funcionar, mas falha porque não é executado em um diretório git, mas cd cmd falha em parar a execução bem-sucedida de outros cmds. Tentei no shell nodeJS, bem como no servidor web nodeJS + ExpressJS.