'use strict';

const yarpm = require('../lib');

const argv = process.argv.slice(2);

exports.run = function run(options) {
  yarpm(argv, Object.assign({stdin: process.stdin, stdout: process.stdout, stderr: process.stderr}, options || {}))
  // Not sure why, but sometimes the process never exits on Git Bash (MINGW64)
    .then(({code}) => process.exit(code))
    .catch(err => {
      console.error(err);
      process.exit(1);
    });
};

'use strict';

const yarpm = require('../lib');

const argv = process.argv.slice(2);

exports.run = function run(options) {
  yarpm(argv, Object.assign({stdin: process.stdin, stdout: process.stdout, stderr: process.stderr}, options || {}))
  // Not sure why, but sometimes the process never exits on Git Bash (MINGW64)
    .then((res) => process.exit(res.code))
    .catch(err => {
      console.error(err);
      process.exit(1);
    });
};

Make it work on Node 4
Make it work on Node 4

Node 4 does not support destructuring.