@@ -29,11 +29,14 @@ class LocalProcess extends ProcessManager {
29
29
* @public
30
30
*/
31
31
start ( cwd , environment ) {
32
+ let isWindows = process . platorm === 'win32' ;
33
+
32
34
return new Promise ( ( resolve , reject ) => {
33
- let cp = spawn ( 'ghost ' , [ 'run' ] , {
35
+ let cp = spawn ( 'node ' , [ process . argv [ 1 ] , 'run' ] , {
34
36
cwd : cwd ,
35
37
detached : true ,
36
- stdio : [ 'ignore' , 'ignore' , 'ignore' , 'ipc' ] ,
38
+ // IPC doesn't work on windows, so we just use 'ignore'
39
+ stdio : isWindows ? 'ignore' : [ 'ignore' , 'ignore' , 'ignore' , 'ipc' ] ,
37
40
env : assign ( { } , process . env , { NODE_ENV : environment } )
38
41
} ) ;
39
42
@@ -47,6 +50,12 @@ class LocalProcess extends ProcessManager {
47
50
reject ( new errors . GhostError ( `Ghost process exited with code: ${ code } ` ) ) ;
48
51
} ) ;
49
52
53
+ if ( isWindows ) {
54
+ cp . disconnect ( ) ;
55
+ cp . unref ( ) ;
56
+ return resolve ( ) ;
57
+ }
58
+
50
59
// Wait until Ghost tells us that it's started correctly, then resolve
51
60
cp . on ( 'message' , ( msg ) => {
52
61
if ( msg . error ) {
@@ -87,7 +96,7 @@ class LocalProcess extends ProcessManager {
87
96
throw e ;
88
97
}
89
98
90
- return fkill ( pid ) . catch ( ( error ) => {
99
+ return fkill ( pid , { force : true } ) . catch ( ( error ) => {
91
100
// TODO: verify windows outputs same error message as mac/linux
92
101
if ( ! error . message . match ( / N o s u c h p r o c e s s / ) ) {
93
102
throw error ;
0 commit comments