How to use the child-process-promise.exec function in child-process-promise

To help you get started, we’ve selected a few child-process-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PokemonGoers / PredictPokemon-2 / prediction.js View on Github external
function test() {
        var cmd = wekaCmd + ' ' + classifier + ' ' + testOptions
            + ' -l ' + activeModelName  // load the trained model with the specified name
            + ' -T ' + testData;        // test data to be evaluated by the trained model
        return exec(cmd, {maxBuffer: 1024 * 1024 * 2}); // 2MB
    }
github PokemonGoers / PredictPokemon-2 / prediction.js View on Github external
function trainModel() {
        var cmd = wekaCmd + ' ' + classifier + ' ' + classifierOptions + ' ' + trainingOptions
            + ' -t ' + trainingData     // training data to be used to create the model
            + ' -d ' + trainingModelName;       // store the trained model with the specified name
        console.log(cmd);
        return exec(cmd);
    }
github react-materialize / react-materialize / docs / dev.js View on Github external
function runCmd(name, cmd, options) {
  exec(cmd, options)
    .progress(childProcess => {
      listen(childProcess, name);
      processMap[name] = childProcess;
      return;
    })
    .then(() => console.log('Shutdown: '.cyan + name.green))
    .catch(err => {
      if (catchExec(name, err)) {
        // Restart if not explicitly shutdown
        runCmd(name, cmd, options);
      }
    });
}
github massgov / mayflower / styleguide / tools / gulp / Artifacts.js View on Github external
const commit = function() {
            // We only need to run a commit if the working copy is dirty.
            return exec("git status --porcelain", {cwd: self.resolveDest()})
                .then((res) => {
                    if(res.stdout.trim().length > 0) {
                        return exec(`git add . && git commit -m ${e(self.getCommitMessage())}`, {cwd: self.resolveDest()});
                    }
                });
        };
        const pushBranch = function() {
github zeit / now / src / serverless / builders / nodejs.js View on Github external
// trigger an install if needed
  if (desc.packageJSON) {
    let buildCommand = ''

    if (existsSync(join(targetPath, 'package-lock.json'))) {
      buildCommand = 'npm install'
    } else if (existsSync(join(targetPath, 'yarn.lock'))) {
      buildCommand = 'yarn install'
    } else {
      buildCommand = 'npm install'
    }

    try {
      debug('executing %s in %s', buildCommand, targetPath)
      await exec(buildCommand, {
        cwd: targetPath,
        env: Object.assign({}, process.env, {
          // we set this so that we make the installers ignore
          // dev dependencies. in the future, we can add a flag
          // to ignore this behavior, or set different envs
          NODE_ENV: 'production'
        })
      })
    } catch (err) {
      throw new Error(
        `The build command ${buildCommand} failed for ${dir}: ${err.message}`
      )
    }
  } else {
    debug('ignoring build step, no manifests found')
  }
github Galarius / vscode-opencl / src / cmd.ts View on Github external
export function execute(command: string): Promise {
    return exec(command, {
        cwd: vscode.workspace.rootPath
    }).then(function(result): Buffer {
        return result.stdout;
    }).fail(function(error) {
        console.error(error);
        let msg = "[Error: " + error.code + "] " + error.stderr;
        vscode.window.showErrorMessage(msg)
        return error
    }).progress(function(childProcess) {
        console.log("Command: " + command + " running...");
    });
}
github twosigma / git-meta / node / lib / util / git_util.js View on Github external
exports.mergeBases = co.wrap(function *(repo, commit1, commit2) {
    const id1 = commit1.id().tostrS();
    const id2 = commit2.id().tostrS();
    const execString = `\
git -C '${repo.path()}' merge-base ${id1} ${id2}`;
    const result = yield ChildProcess.exec(execString, {
        maxBuffer: EXEC_BUFFER
    });
    if (result.error) {
        throw new UserError("Couldn't run git merge-base: " +
                            result.stderr);
    }
    return result.stdout.split("\n").filter(x => x);
});
github lightning-viz / lightning / app / models / visualizationtype.js View on Github external
_createLinkNPM: function(command, installName, moduleName, preview) {
                var self = this;
                var loglevel = npm.config.get('loglevel');
                npm.config.set('loglevel', 'silent');
                return exec('npm uninstall ' + installName)
                    .then(function(results) {
                        return exec(command);
                    }).then(function() {
                        npm.config.set('loglevel', loglevel);
                        debug(('Successfully installed ' + installName).green);
                        return self._buildFromNPM(moduleName, preview);
                    });
            },

child-process-promise

Simple wrapper around the "child_process" module that makes use of promises

MIT
Latest version published 7 years ago

Package Health Score

56 / 100
Full package analysis

Popular child-process-promise functions