mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
20 lines
501 B
JavaScript
20 lines
501 B
JavaScript
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
|
|
};
|