1 | 'use strict';
|
2 |
|
3 | const execa = require('execa');
|
4 | const debug = require('debug')('ember-try:utils:run');
|
5 |
|
6 | module.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 |
|
22 | throw error.exitCode;
|
23 | }
|
24 | };
|