summaryrefslogtreecommitdiffstats
path: root/lib/utils/command.js
blob: f395fa1d17922867c8f1c115a728d7685175c58b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var childProcess = require('child_process');
var Promise = require('./promise');

// On borwser, command execution is not possible
var isAvailable = childProcess && childProcess.exec;

// Execute a command
function exec(command, options) {
    if (!isAvailable) {
        return Promise.reject(new Error('Command execution is not possible on this platform'));
    }

    return Promise.nfcall(childProcess.exec, command, options);
}

module.exports = {
    isAvailable: isAvailable,
    exec: exec
};