File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
cmp/compiler/src/metadata Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -119,6 +119,23 @@ export class MetadataManager {
119119 DEFAULT_TIMEOUTS . METADATA ,
120120 "Save metadata (atomic rename)" ,
121121 ) ;
122+ } catch ( error ) {
123+ // On Windows, rename() can fail with EPERM if something briefly holds the file.
124+ // As a fallback, try writing directly to the destination (not atomic).
125+ if (
126+ error &&
127+ typeof error === "object" &&
128+ "code" in error &&
129+ error . code === "EPERM"
130+ ) {
131+ await withTimeout (
132+ fsPromises . writeFile ( this . filePath , json , "utf-8" ) ,
133+ DEFAULT_TIMEOUTS . METADATA ,
134+ "Save metadata (EPERM fallback direct write)" ,
135+ ) ;
136+ return ;
137+ }
138+ throw error ;
122139 } finally {
123140 // Best-effort cleanup if rename failed for some reason
124141 await fsPromises . unlink ( tmpPath ) . catch ( ( ) => { } ) ;
You can’t perform that action at this time.
0 commit comments