This repository was archived by the owner on Jan 11, 2023. It is now read-only.
File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,12 @@ class Watcher extends EventEmitter {
130
130
// TODO watch the configs themselves?
131
131
const compilers = create_compilers ( { webpack : this . dirs . webpack } ) ;
132
132
133
+ const emitFatal = ( ) => {
134
+ this . emit ( 'fatal' , < events . FatalEvent > {
135
+ message : `Server crashed`
136
+ } ) ;
137
+ } ;
138
+
133
139
this . watch ( compilers . server , {
134
140
name : 'server' ,
135
141
@@ -158,6 +164,7 @@ class Watcher extends EventEmitter {
158
164
} ;
159
165
160
166
if ( this . proc ) {
167
+ this . proc . removeListener ( 'exit' , emitFatal ) ;
161
168
this . proc . kill ( ) ;
162
169
this . proc . on ( 'exit' , restart ) ;
163
170
} else {
@@ -172,13 +179,23 @@ class Watcher extends EventEmitter {
172
179
stdio : [ 'ipc' ]
173
180
} ) ;
174
181
182
+ this . proc . stdout . on ( 'data' , chunk => {
183
+ this . emit ( 'stdout' , chunk ) ;
184
+ } ) ;
185
+
186
+ this . proc . stderr . on ( 'data' , chunk => {
187
+ this . emit ( 'stderr' , chunk ) ;
188
+ } ) ;
189
+
175
190
this . proc . on ( 'message' , message => {
176
191
if ( message . __sapper__ && message . event === 'basepath' ) {
177
192
this . emit ( 'basepath' , {
178
193
basepath : message . basepath
179
194
} ) ;
180
195
}
181
196
} ) ;
197
+
198
+ this . proc . on ( 'exit' , emitFatal ) ;
182
199
} ) ;
183
200
}
184
201
} ) ;
You can’t perform that action at this time.
0 commit comments