@@ -490,7 +490,7 @@ it.layer(NodeServices.layer)("boot service install", (it) => {
490490 expect (
491491 commands . filter (
492492 ( command ) =>
493- command . startsWith ( " systemctl ") &&
493+ command . startsWith ( platform === "linux" ? " systemctl " : "launchctl ") &&
494494 ! command . includes ( "show-environment" ) ,
495495 ) ,
496496 ) . toEqual (
@@ -580,79 +580,72 @@ it.layer(NodeServices.layer)("boot service install", (it) => {
580580 } ) ,
581581 ) ;
582582
583- it . effect (
584- "refuses a deferred legacy install before commands or filesystem changes" ,
585- ( ) =>
586- Effect . gen ( function * ( ) {
587- const { service, fs, statePath, commands, makeService } = yield * makeHarness ( ) ;
588- const path = yield * Path . Path ;
589- const plan = yield * service . install ( ) ;
590- const unitBefore = yield * fs . readFileString ( plan . unitPath ) ;
591- const legacyState = '{"protocol":2,"activeVersion":"1.2.3"}' ;
592- const restartPending = path . join ( path . dirname ( statePath ) , SERVICE_RESTART_PENDING_FILE ) ;
593- const newer = yield * makeService ( undefined , "1.2.4" ) ;
594- yield * fs . writeFileString ( statePath , legacyState ) ;
595- yield * fs . writeFileString ( restartPending , "1.2.3\n" ) ;
596- yield * fs . remove ( path . dirname ( plan . logPath ) , { recursive : true } ) ;
597- commands . length = 0 ;
583+ it . effect ( "refuses a deferred legacy install before commands or filesystem changes" , ( ) =>
584+ Effect . gen ( function * ( ) {
585+ const { service, fs, statePath, commands, makeService } = yield * makeHarness ( ) ;
586+ const path = yield * Path . Path ;
587+ const plan = yield * service . install ( ) ;
588+ const unitBefore = yield * fs . readFileString ( plan . unitPath ) ;
589+ const legacyState = '{"protocol":2,"activeVersion":"1.2.3"}' ;
590+ const restartPending = path . join ( path . dirname ( statePath ) , SERVICE_RESTART_PENDING_FILE ) ;
591+ const newer = yield * makeService ( undefined , "1.2.4" ) ;
592+ yield * fs . writeFileString ( statePath , legacyState ) ;
593+ yield * fs . writeFileString ( restartPending , "1.2.3\n" ) ;
594+ yield * fs . remove ( path . dirname ( plan . logPath ) , { recursive : true } ) ;
595+ commands . length = 0 ;
598596
599- const result = yield * newer . install ( { start : false } ) . pipe ( Effect . result ) ;
597+ const result = yield * newer . install ( { start : false } ) . pipe ( Effect . result ) ;
600598
601- expect ( yield * fs . readFileString ( statePath ) ) . toBe ( legacyState ) ;
602- expect ( result ) . toMatchObject ( {
603- _tag : "Failure" ,
604- failure : {
605- _tag : "BootServiceMigrationRequiredError" ,
606- message : expect . stringContaining ( "t3 update --yes" ) ,
607- } ,
608- } ) ;
609- expect ( yield * fs . readFileString ( plan . unitPath ) ) . toBe ( unitBefore ) ;
610- expect ( yield * fs . readFileString ( restartPending ) ) . toBe ( "1.2.3\n" ) ;
611- expect ( yield * fs . exists ( path . dirname ( plan . logPath ) ) ) . toBe ( false ) ;
612- expect ( commands ) . toEqual ( [ ] ) ;
613- } ) ,
599+ expect ( yield * fs . readFileString ( statePath ) ) . toBe ( legacyState ) ;
600+ expect ( result ) . toMatchObject ( {
601+ _tag : "Failure" ,
602+ failure : {
603+ _tag : "BootServiceMigrationRequiredError" ,
604+ message : expect . stringContaining ( "t3 update --yes" ) ,
605+ } ,
606+ } ) ;
607+ expect ( yield * fs . readFileString ( plan . unitPath ) ) . toBe ( unitBefore ) ;
608+ expect ( yield * fs . readFileString ( restartPending ) ) . toBe ( "1.2.3\n" ) ;
609+ expect ( yield * fs . exists ( path . dirname ( plan . logPath ) ) ) . toBe ( false ) ;
610+ expect ( commands ) . toEqual ( [ ] ) ;
611+ } ) ,
614612 ) ;
615613
616- it . effect (
617- "rechecks legacy state after preparing a deferred install" ,
618- ( ) =>
619- Effect . gen ( function * ( ) {
620- const { service, fs, statePath, commands, makeService, control } =
621- yield * makeHarness ( ) ;
622- const path = yield * Path . Path ;
623- const plan = yield * service . install ( ) ;
624- const unitBefore = yield * fs . readFileString ( plan . unitPath ) ;
625- const legacyState = '{"protocol":2,"activeVersion":"1.2.3"}' ;
626- const newer = yield * makeService ( undefined , "1.2.4" ) ;
627- control . onCommand = ( command ) =>
628- command . endsWith ( " --version" )
629- ? fs . writeFileString ( statePath , legacyState ) . pipe ( Effect . orDie )
630- : Effect . void ;
631- commands . length = 0 ;
614+ it . effect ( "rechecks legacy state after preparing a deferred install" , ( ) =>
615+ Effect . gen ( function * ( ) {
616+ const { service, fs, statePath, commands, makeService, control } = yield * makeHarness ( ) ;
617+ const path = yield * Path . Path ;
618+ const plan = yield * service . install ( ) ;
619+ const unitBefore = yield * fs . readFileString ( plan . unitPath ) ;
620+ const legacyState = '{"protocol":2,"activeVersion":"1.2.3"}' ;
621+ const newer = yield * makeService ( undefined , "1.2.4" ) ;
622+ control . onCommand = ( command ) =>
623+ command . endsWith ( " --version" )
624+ ? fs . writeFileString ( statePath , legacyState ) . pipe ( Effect . orDie )
625+ : Effect . void ;
626+ commands . length = 0 ;
632627
633- const result = yield * newer . install ( { start : false } ) . pipe ( Effect . result ) ;
628+ const result = yield * newer . install ( { start : false } ) . pipe ( Effect . result ) ;
634629
635- expect ( commands . some ( ( command ) => command . endsWith ( " --version" ) ) ) . toBe ( true ) ;
636- expect ( yield * fs . readFileString ( statePath ) ) . toBe ( legacyState ) ;
637- expect ( result ) . toMatchObject ( {
638- _tag : "Failure" ,
639- failure : {
640- _tag : "BootServiceMigrationRequiredError" ,
641- message : expect . stringContaining ( "t3 update --yes" ) ,
642- } ,
643- } ) ;
644- expect ( yield * fs . readFileString ( plan . unitPath ) ) . toBe ( unitBefore ) ;
645- expect (
646- yield * fs . exists ( path . join ( path . dirname ( statePath ) , SERVICE_RESTART_PENDING_FILE ) ) ,
647- ) . toBe ( false ) ;
648- expect (
649- commands . filter (
650- ( command ) =>
651- command . startsWith ( "systemctl " ) &&
652- ! command . includes ( "show-environment" ) ,
653- ) ,
654- ) . toEqual ( [ ] ) ;
655- } ) ,
630+ expect ( commands . some ( ( command ) => command . endsWith ( " --version" ) ) ) . toBe ( true ) ;
631+ expect ( yield * fs . readFileString ( statePath ) ) . toBe ( legacyState ) ;
632+ expect ( result ) . toMatchObject ( {
633+ _tag : "Failure" ,
634+ failure : {
635+ _tag : "BootServiceMigrationRequiredError" ,
636+ message : expect . stringContaining ( "t3 update --yes" ) ,
637+ } ,
638+ } ) ;
639+ expect ( yield * fs . readFileString ( plan . unitPath ) ) . toBe ( unitBefore ) ;
640+ expect (
641+ yield * fs . exists ( path . join ( path . dirname ( statePath ) , SERVICE_RESTART_PENDING_FILE ) ) ,
642+ ) . toBe ( false ) ;
643+ expect (
644+ commands . filter (
645+ ( command ) => command . startsWith ( "systemctl " ) && ! command . includes ( "show-environment" ) ,
646+ ) ,
647+ ) . toEqual ( [ ] ) ;
648+ } ) ,
656649 ) ;
657650
658651 it . effect ( "install with start=false keeps the marker when a later write fails" , ( ) =>
0 commit comments