UNPKG

628 BJavaScriptView Raw
1'use strict';
2
3const execa = require('execa');
4const debug = require('debug')('ember-try:utils:run');
5
6module.exports = async function run(command, args, _options) {
7 let options = Object.assign({ stdio: 'inherit', shell: true }, _options);
8
9 if (process.env.SHUT_UP) {
10 options.stdio = 'ignore';
11 }
12
13 let cmdArgs = `${command} ${args.join(' ')}`;
14 try {
15 debug('spawning execa.shell', cmdArgs, options);
16
17 return await execa(cmdArgs, options);
18 } catch (error) {
19 debug('error', error);
20
21 // TODO: should refactor this to throw an error (easier to track down stack traces)
22 throw error.exitCode;
23 }
24};