RIAEvangelist/node-cmd

CD doesnt change directory

Closed this issue · 1 comments

I am using the bluebird library to use promises, and I have to CD to a certain directory and then run a command. I am using getAsync like this:

var cmd = require('node-cmd');
var Promise = require('bluebird');
const getAsync = Promise.promisify(cmd.get, { multiArgs: true, context: cmd });

getAsync('cd C:\\Program Files (x86)\\CouchDB Telemetry Integrator')  //change directories (FAILS)

.then(function(){
    console.log("Changed Directory to \\CouchDB Telemetry Integrator ");
})

.then(function(){  // lists directory contents
    getAsync(
        'dir',
        function(err, data, stderr){
            console.log('the current dir contains these files :\n\n',data)
        }
    )
})

.catch(function(err){
    console.log(err);
});

The problem is that when I list the dir contents it actually shows that I am in my root folder and did not change directories. Why is this happening?

Nvm Instead of dealing with promises I ran as a single line argument referencing Sam Thompson's answer to #18