index.js
function RunGruntTask(taskname,absolutePath) {
    var exec = require('child_process').exec;
    var gruntarg = ' --gruntfile ';
    var space = ' ';

    if (os === 'Windows_NT') {
        gruntPath = 'node_modules\\grunt-cli\\bin\\grunt' || absolutePath;
        var ShellTask = gruntPath + space + gruntarg + gruntfile + space + taskname;
        var GruntTask = new shell(ShellTask);
        GruntTask.on('output', function(data) {
            console.log(data);
        });
        GruntTask.on('end', function(code) {
            console.log("Execution done");
        });
    }

    if (os === 'Darwin' || os === 'Linux') {
        gruntPath = 'node_modules/grunt-cli/bin/grunt';
        var child = exec(gruntPath + gruntarg + gruntfile + space + taskname, function(error, stdout, stderr) {
            if (error !== null) {
                console.log('exec error: ' + error);
                var stdout = error;
                return stdout;
            } else {
                console.log('stdout: ' + stdout);
                return stdout;
            }

        });
    }
}
function RunGruntTask(taskname,absolutePath) {
    var exec = require('child_process').exec;
    var gruntarg = ' --gruntfile ';
    var space = ' ';

    if (os === 'Windows_NT') {
        gruntPath = 'node_modules\\grunt-cli\\bin\\grunt' || absolutePath;
        var ShellTask = gruntPath + space + gruntarg + gruntfile + space + taskname;
        var GruntTask = new shell(ShellTask);
        GruntTask.on('output', function(data) {
            console.log(data);
        });
        GruntTask.on('end', function(code) {
            console.log("Execution done");
        });
    }

    if (os === 'Darwin' || os === 'Linux') {
        gruntPath = 'node_modules/grunt-cli/bin/grunt';
        var child = exec(gruntPath + gruntarg + gruntfile + space + taskname, function(error, stdout, stderr) {
            if (error !== null) {
                console.log('exec error: ' + error);
                var stdout = error;
                return stdout;
            } else {
                console.log('stdout: ' + stdout);
                return stdout;
            }

        });
    }
}
function RunGruntTask ( taskname , absolutePath ) { var exec = require ( 'child_process' ) . exec ; var gruntarg = ' --gruntfile ' ; var space = ' ' ; if ( os === 'Windows_NT' ) { gruntPath = 'node_modules\\grunt-cli\\bin\\grunt' || absolutePath ; var ShellTask = gruntPath + space + gruntarg + gruntfile + space + taskname ; var GruntTask = new shell ( ShellTask ) ; GruntTask . on ( 'output' , function ( data ) { console . log ( data ) ; } ) ; GruntTask . on ( 'end' , function ( code ) { console . log ( "Execution done" ) ; } ) ; } if ( os === 'Darwin' || os === 'Linux' ) { gruntPath = 'node_modules/grunt-cli/bin/grunt' ; var child = exec ( gruntPath + gruntarg + gruntfile + space + taskname , function ( error , stdout , stderr ) { if ( error !== null ) { console . log ( 'exec error: ' + error ) ; var stdout = error ; return stdout ; } else { console . log ( 'stdout: ' + stdout ) ; return stdout ; } } ) ; } }
This would look for the GruntFile.js in your application structure
This would look for the GruntFile . js in your application structure