@@ -120,9 +120,13 @@ const make = Effect.gen(function* () {
120120 const isHeld = ( file : string ) => readRecord ( file ) . pipe ( Effect . map ( ( record ) => record . held ) ) ;
121121
122122 /** Publishes a complete record exclusively; a paused writer must never look abandoned. */
123- const createExclusively = ( file : string , contents : string , owner : string ) => {
123+ const createExclusively = Effect . fn ( "ProviderInstallLock.createExclusively" ) ( function * (
124+ file : string ,
125+ contents : string ,
126+ owner : string ,
127+ ) {
124128 const temporary = `${ file } .${ owner } .tmp` ;
125- return Effect . gen ( function * ( ) {
129+ return yield * Effect . gen ( function * ( ) {
126130 const handle = yield * fileSystem . open ( temporary , { flag : "wx" } ) ;
127131 yield * handle . writeAll ( new TextEncoder ( ) . encode ( contents ) ) ;
128132 } ) . pipe (
@@ -136,7 +140,7 @@ const make = Effect.gen(function* () {
136140 error . reason . _tag === "AlreadyExists" ? Effect . succeed ( false ) : Effect . fail ( error ) ,
137141 } ) ,
138142 ) ;
139- } ;
143+ } ) ;
140144
141145 const generations = Effect . gen ( function * ( ) {
142146 const names = yield * fileSystem . readDirectory ( directory ) . pipe ( ignoreNotFound ( [ ] ) ) ;
@@ -146,13 +150,17 @@ const make = Effect.gen(function* () {
146150 } ) ;
147151 } ) ;
148152
149- const replace = ( file : string , next : string , owner : string ) => {
153+ const replace = Effect . fn ( "ProviderInstallLock.replace" ) ( function * (
154+ file : string ,
155+ next : string ,
156+ owner : string ,
157+ ) {
150158 const temporary = `${ file } .${ owner } .tmp` ;
151- return fileSystem . writeFileString ( temporary , next ) . pipe (
159+ return yield * fileSystem . writeFileString ( temporary , next ) . pipe (
152160 Effect . andThen ( fileSystem . rename ( temporary , file ) ) ,
153161 Effect . onError ( ( ) => fileSystem . remove ( temporary , { force : true } ) . pipe ( Effect . ignore ) ) ,
154162 ) ;
155- } ;
163+ } ) ;
156164 const historyFile = ( provider : string ) =>
157165 path . join ( directory , `${ encodeURIComponent ( provider ) } .installed` ) ;
158166
0 commit comments