@@ -215,6 +215,28 @@ function acquireBuild() {
215
215
}
216
216
}
217
217
218
+
219
+ function onUncaughtException ( err ) {
220
+ console . error ( "Uncaught Exception" , err ) ;
221
+ releaseBuild ( ) ;
222
+ process . exit ( 1 ) ;
223
+ }
224
+ function exitProcess ( ) {
225
+ releaseBuild ( ) ;
226
+ process . exit ( 0 ) ;
227
+ }
228
+
229
+ process . on ( "uncaughtException" , onUncaughtException ) ;
230
+
231
+ // OS signal handlers
232
+ // Ctrl+C
233
+ process . on ( "SIGINT" , exitProcess ) ;
234
+ // kill pid
235
+ process . on ( "SIGUSR1" , exitProcess ) ;
236
+ process . on ( "SIGUSR2" , exitProcess ) ;
237
+ process . on ( "SIGTERM" , exitProcess ) ;
238
+ process . on ( "SIGHUP" , exitProcess ) ;
239
+
218
240
if (
219
241
maybe_subcommand !== undefined &&
220
242
maybe_subcommand !== "build" &&
@@ -337,27 +359,6 @@ if (
337
359
*/
338
360
var watchers = [ ] ;
339
361
340
- function onUncaughtException ( err ) {
341
- console . error ( "Uncaught Exception" , err ) ;
342
- releaseBuild ( ) ;
343
- process . exit ( 1 ) ;
344
- }
345
- function exitProcess ( ) {
346
- releaseBuild ( ) ;
347
- process . exit ( 0 ) ;
348
- }
349
-
350
- process . on ( "uncaughtException" , onUncaughtException ) ;
351
-
352
- // OS signal handlers
353
- // Ctrl+C
354
- process . on ( "SIGINT" , exitProcess ) ;
355
- // kill pid
356
- process . on ( "SIGUSR1" , exitProcess ) ;
357
- process . on ( "SIGUSR2" , exitProcess ) ;
358
- process . on ( "SIGTERM" , exitProcess ) ;
359
- process . on ( "SIGHUP" , exitProcess ) ;
360
-
361
362
process . stdin . on ( "close" , exitProcess ) ;
362
363
// close when stdin stops
363
364
if ( os . platform ( ) !== "win32" ) {
0 commit comments