@@ -31,8 +31,8 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<strin
31
31
spawnOptions [ 'stdio' ] = 'pipe' ;
32
32
}
33
33
34
- const npmProcess = child_process . spawn ( cmd , args , spawnOptions ) ;
35
- npmProcess . stdout . on ( 'data' , ( data : Buffer ) => {
34
+ const childProcess = child_process . spawn ( cmd , args , spawnOptions ) ;
35
+ childProcess . stdout . on ( 'data' , ( data : Buffer ) => {
36
36
stdout += data . toString ( 'utf-8' ) ;
37
37
if ( options . silent ) {
38
38
return ;
@@ -42,21 +42,21 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<strin
42
42
. filter ( line => line !== '' )
43
43
. forEach ( line => console . log ( ' ' + line ) ) ;
44
44
} ) ;
45
- npmProcess . stderr . on ( 'data' , ( data : Buffer ) => {
45
+ childProcess . stderr . on ( 'data' , ( data : Buffer ) => {
46
46
stderr += data . toString ( 'utf-8' ) ;
47
47
data . toString ( 'utf-8' )
48
48
. split ( / [ \n \r ] + / )
49
49
. filter ( line => line !== '' )
50
50
. forEach ( line => console . error ( yellow ( ' ' + line ) ) ) ;
51
51
} ) ;
52
52
53
- _processes . push ( npmProcess ) ;
53
+ _processes . push ( childProcess ) ;
54
54
55
55
// Create the error here so the stack shows who called this function.
56
56
const err = new Error ( `Running "${ cmd } ${ args . join ( ' ' ) } " returned error code ` ) ;
57
57
return new Promise ( ( resolve , reject ) => {
58
- npmProcess . on ( 'exit' , ( error : any ) => {
59
- _processes = _processes . filter ( p => p !== npmProcess ) ;
58
+ childProcess . on ( 'exit' , ( error : any ) => {
59
+ _processes = _processes . filter ( p => p !== childProcess ) ;
60
60
61
61
if ( ! error ) {
62
62
resolve ( stdout ) ;
@@ -67,7 +67,7 @@ function _exec(options: ExecOptions, cmd: string, args: string[]): Promise<strin
67
67
} ) ;
68
68
69
69
if ( options . waitForMatch ) {
70
- npmProcess . stdout . on ( 'data' , ( data : Buffer ) => {
70
+ childProcess . stdout . on ( 'data' , ( data : Buffer ) => {
71
71
if ( data . toString ( ) . match ( options . waitForMatch ) ) {
72
72
resolve ( stdout ) ;
73
73
}
@@ -113,6 +113,10 @@ export function npm(...args: string[]) {
113
113
return _exec ( { } , 'npm' , args ) ;
114
114
}
115
115
116
+ export function node ( ...args : string [ ] ) {
117
+ return _exec ( { } , 'node' , args ) ;
118
+ }
119
+
116
120
export function git ( ...args : string [ ] ) {
117
121
return _exec ( { } , 'git' , args ) ;
118
122
}
0 commit comments