@@ -332,7 +332,7 @@ class Server {
332
332
"SSL Certificate is more than 30 days old. Removing..."
333
333
) ;
334
334
335
- del . sync ( [ certificatePath ] , { force : true } ) ;
335
+ await del ( [ certificatePath ] , { force : true } ) ;
336
336
337
337
certificateExists = false ;
338
338
}
@@ -405,13 +405,35 @@ class Server {
405
405
] ,
406
406
} ) ;
407
407
408
- fs . mkdirSync ( certificateDir , { recursive : true } ) ;
409
- fs . writeFileSync ( certificatePath , pems . private + pems . cert , {
410
- encoding : "utf8" ,
408
+ await fs . mkdir ( certificateDir , { recursive : true } , ( error ) => {
409
+ if ( error ) {
410
+ this . logger . error ( error ) ;
411
+ process . exit ( 2 ) ;
412
+ }
411
413
} ) ;
414
+
415
+ await fs . writeFile (
416
+ certificatePath ,
417
+ pems . private + pems . cert ,
418
+ {
419
+ encoding : "utf8" ,
420
+ } ,
421
+ ( error ) => {
422
+ if ( error ) {
423
+ this . logger . error ( error ) ;
424
+ process . exit ( 2 ) ;
425
+ }
426
+ }
427
+ ) ;
412
428
}
413
429
414
- fakeCert = fs . readFileSync ( certificatePath ) ;
430
+ fakeCert = await fs . readFile ( certificatePath , ( error , data ) => {
431
+ if ( error ) {
432
+ this . logger . error ( error ) ;
433
+ process . exit ( 2 ) ;
434
+ }
435
+ return data ;
436
+ } ) ;
415
437
416
438
this . logger . info ( `SSL certificate: ${ certificatePath } ` ) ;
417
439
}
@@ -1763,7 +1785,12 @@ class Server {
1763
1785
// chmod 666 (rw rw rw)
1764
1786
const READ_WRITE = 438 ;
1765
1787
1766
- fs . chmodSync ( this . options . ipc , READ_WRITE ) ;
1788
+ await fs . chmod ( this . options . ipc , READ_WRITE , ( error ) => {
1789
+ if ( error ) {
1790
+ this . logger . error ( error ) ;
1791
+ process . exit ( 2 ) ;
1792
+ }
1793
+ } ) ;
1767
1794
}
1768
1795
1769
1796
if ( this . options . webSocketServer ) {
0 commit comments