1- /// <reference path="./hasbin.d.ts" />
1+ // / <reference path="./hasbin.d.ts" />
22
33/* eslint-env node */
44
@@ -171,8 +171,7 @@ export default class IssoManagement {
171171 }
172172 } ) ;
173173 } else {
174- imageInstall = findDocker ( )
175- . then ( docker => execAndPrint ( `${ docker } pull ${ ISSO_IMAGE } ` ) ) ;
174+ imageInstall = findDocker ( ) . then ( docker => execAndPrint ( `${ docker } pull ${ ISSO_IMAGE } ` ) ) ;
176175 }
177176 return imageInstall
178177 . then ( ( ) => tmp . dir ( ) )
@@ -381,8 +380,7 @@ class Isso {
381380 /**
382381 * Creates a new isso server instance with the given instance id (but does not start it)
383382 */
384- public constructor ( public readonly id : number ) {
385- }
383+ public constructor ( public readonly id : number ) { }
386384
387385 /**
388386 * Starts this instance if it’s not already running.
@@ -393,43 +391,48 @@ class Isso {
393391 if ( this . process !== undefined ) {
394392 return Promise . resolve ( ) ;
395393 }
396- return findDocker ( )
397- . then ( docker => new Promise ( ( resolve , reject ) => {
398- this . process = execFile (
399- docker ,
400- [
401- 'run' ,
402- '--rm' ,
403- '--network' , 'host' ,
404- '-v' , `${ this . configDir } :/config` ,
405- '-v' , `${ this . dbDir } :/db` ,
406- ISSO_IMAGE
407- ] ,
408- error => {
409- if ( error && ! error . killed ) {
410- this . stop ( ) . finally ( ( ) => reject ( error ) ) ;
394+ return findDocker ( ) . then (
395+ docker =>
396+ new Promise ( ( resolve , reject ) => {
397+ this . process = execFile (
398+ docker ,
399+ [
400+ 'run' ,
401+ '--rm' ,
402+ '--network' ,
403+ 'host' ,
404+ '-v' ,
405+ `${ this . configDir } :/config` ,
406+ '-v' ,
407+ `${ this . dbDir } :/db` ,
408+ ISSO_IMAGE
409+ ] ,
410+ error => {
411+ if ( error && ! error . killed ) {
412+ this . stop ( ) . finally ( ( ) => reject ( error ) ) ;
413+ }
411414 }
412- }
413- ) ;
414- const startTimeout = setTimeout (
415- ( ) => this . stop ( ) . finally ( ( ) => reject ( 'Isso did not start within 20 seconds!' ) ) ,
416- 20000
417- ) ;
418-
419- const startListener = ( data : string ) : void => {
420- clearTimeout ( startTimeout ) ;
421- this . process ?. stderr ?. removeListener ( 'data' , startListener ) ;
422- if ( ! INFO_REGEX . test ( data ) ) {
423- console . error ( data ) ;
424- this . stop ( ) . finally ( ( ) => reject ( data ) ) ;
425- } else if ( STARTED_REGEX . test ( data ) ) {
426- resolve ( ) ;
427- }
428- } ;
415+ ) ;
416+ const startTimeout = setTimeout (
417+ ( ) => this . stop ( ) . finally ( ( ) => reject ( 'Isso did not start within 20 seconds!' ) ) ,
418+ 20000
419+ ) ;
420+
421+ const startListener = ( data : string ) : void => {
422+ clearTimeout ( startTimeout ) ;
423+ this . process ?. stderr ?. removeListener ( 'data' , startListener ) ;
424+ if ( ! INFO_REGEX . test ( data ) ) {
425+ console . error ( data ) ;
426+ this . stop ( ) . finally ( ( ) => reject ( data ) ) ;
427+ } else if ( STARTED_REGEX . test ( data ) ) {
428+ resolve ( ) ;
429+ }
430+ } ;
429431
430- this . process . stderr ?. on ( 'data' , startListener ) ;
431- printSpawned ( this . process ) ;
432- } ) ) ;
432+ this . process . stderr ?. on ( 'data' , startListener ) ;
433+ printSpawned ( this . process ) ;
434+ } )
435+ ) ;
433436 }
434437
435438 /**
@@ -454,7 +457,7 @@ class Isso {
454457 */
455458 public removeDatabase ( ) : Promise < void > {
456459 return rmrf ( this . dbDir ) . then ( ( ) =>
457- fs . promises . mkdir ( this . dbDir , { mode : 0o777 , recursive : true } )
460+ fs . promises . mkdir ( this . dbDir , { mode : 0o777 , recursive : true } )
458461 ) ;
459462 }
460463
@@ -482,8 +485,8 @@ class Isso {
482485 enabled = false
483486 ` . replace ( / \t / g, '' ) ;
484487 return rmrf ( this . configDir )
485- . then ( ( ) => fs . promises . mkdir ( this . configDir , { mode : 0o777 , recursive : true } ) )
486- . then ( ( ) => writeFile ( `${ this . configDir } /isso.conf` , config , { mode : 0o777 } ) ) ;
488+ . then ( ( ) => fs . promises . mkdir ( this . configDir , { mode : 0o777 , recursive : true } ) )
489+ . then ( ( ) => writeFile ( `${ this . configDir } /isso.conf` , config , { mode : 0o777 } ) ) ;
487490 }
488491
489492 private get configDir ( ) : string {
0 commit comments