File tree 3 files changed +32
-3
lines changed
3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 7
7
8
8
'use strict' ;
9
9
10
- var crossSpawn = require ( 'cross-spawn' ) ;
10
+ const { spawn } = require ( 'child_process' ) ;
11
+
12
+ function crossSpawn ( file , args , options ) {
13
+ if ( typeof file !== 'string' || file . length === 0 ) {
14
+ throw new TypeError ( '"file" argument must be a non-empty string' ) ;
15
+ }
16
+
17
+ if ( Array . isArray ( args ) ) {
18
+ args = args . slice ( 0 ) ;
19
+ } else if (
20
+ args !== undefined &&
21
+ ( args === null || typeof args !== 'object' )
22
+ ) {
23
+ throw new TypeError ( 'Incorrect value of args option' ) ;
24
+ } else {
25
+ options = args ;
26
+ args = [ ] ;
27
+ }
28
+
29
+ if ( options === undefined ) {
30
+ options = { } ;
31
+ } else if ( options === null || typeof options !== 'object' ) {
32
+ throw new TypeError ( '"options" argument must be an object' ) ;
33
+ }
34
+
35
+ // Default to using a shell on Windows
36
+ if ( options . shell === undefined && process . platform === 'win32' ) {
37
+ options . shell = true ;
38
+ }
39
+ return spawn ( file , args , options ) ;
40
+ }
11
41
12
42
module . exports = crossSpawn ;
Original file line number Diff line number Diff line change 9
9
10
10
var chalk = require ( 'chalk' ) ;
11
11
var execSync = require ( 'child_process' ) . execSync ;
12
- var spawn = require ( 'cross-spawn ' ) ;
12
+ var spawn = require ( './crossSpawn ' ) ;
13
13
var opn = require ( 'opn' ) ;
14
14
15
15
// https://github.com/sindresorhus/opn#app
Original file line number Diff line number Diff line change 39
39
"address" : " 1.0.3" ,
40
40
"babel-code-frame" : " 6.26.0" ,
41
41
"chalk" : " 1.1.3" ,
42
- "cross-spawn" : " 5.1.0" ,
43
42
"detect-port-alt" : " 1.1.3" ,
44
43
"escape-string-regexp" : " 1.0.5" ,
45
44
"filesize" : " 3.5.11" ,
You can’t perform that action at this time.
0 commit comments