1
1
import process from 'process'
2
2
3
- import { execa , ExecaChildProcess , execaCommand , Options } from 'execa'
3
+ import { execa , ExecaChildProcess , execaCommand , Options , CommonOptions } from 'execa'
4
4
5
5
/** Allow running local binaries by default */
6
- const DEFAULT_OPTIONS : Partial < Options < string > > = { preferLocal : true }
6
+ const DEFAULT_OPTIONS : Partial < CommonOptions > = { preferLocal : true }
7
7
8
8
/** Run a command, with arguments being an array */
9
- export const run = ( file : string , args ?: string [ ] | object , options ?: Record < string , unknown > ) => {
9
+ export const run = ( file : string , args ?: string [ ] | object , options ?: Options ) => {
10
10
const [ argsA , optionsA ] = parseArgs ( args , options )
11
11
const optionsB = { ...DEFAULT_OPTIONS , ...optionsA }
12
12
const childProcess = execa ( file , argsA , optionsB )
@@ -15,9 +15,9 @@ export const run = (file: string, args?: string[] | object, options?: Record<str
15
15
}
16
16
17
17
/** Run a command, with file + arguments being a single string */
18
- export const runCommand = ( command : string , options : Options < string > ) => {
18
+ export const runCommand = ( command : string , options : Options ) => {
19
19
const optionsA = { ...DEFAULT_OPTIONS , ...options }
20
- const childProcess = execaCommand ( command , optionsA )
20
+ const childProcess = execaCommand ( command , options )
21
21
redirectOutput ( childProcess , optionsA )
22
22
return childProcess
23
23
}
@@ -38,7 +38,7 @@ const parseArgs = function (args, options) {
38
38
/**
39
39
* Redirect output by default, unless specified otherwise
40
40
* */
41
- const redirectOutput = ( childProcess : ExecaChildProcess < string > , options : Options < string > ) => {
41
+ const redirectOutput = ( childProcess : ExecaChildProcess < string > , options : CommonOptions ) => {
42
42
if ( options . stdio !== undefined || options . stdout !== undefined || options . stderr !== undefined ) {
43
43
return
44
44
}
0 commit comments