File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
modules/build/src/main/scala/scala/build Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -77,18 +77,21 @@ object LocalRepo {
77
77
78
78
if ! os.exists(repoDir) then
79
79
withLock((repoDir / os.up).toNIO, version) {
80
- val tmpRepoDir = repoDir / os.up / s " . $version.tmp "
81
- try os.remove.all(tmpRepoDir)
82
- catch {
83
- case t : Throwable =>
84
- logger.message(s " Error removing $tmpRepoDir: ${t.getMessage}" )
85
- }
86
- using(archiveUrl.openStream()) { is =>
87
- using(WrappedZipInputStream .create(new BufferedInputStream (is))) { zis =>
88
- extractZip(zis, tmpRepoDir)
80
+ // Post-lock validation: Recheck repository directory existence to handle
81
+ // potential race conditions between initial check and lock acquisition
82
+ if ! os.exists(repoDir) then
83
+ val tmpRepoDir = repoDir / os.up / s " . $version.tmp "
84
+ try os.remove.all(tmpRepoDir)
85
+ catch {
86
+ case t : Throwable =>
87
+ logger.message(s " Error removing $tmpRepoDir: ${t.getMessage}" )
89
88
}
90
- }
91
- os.move(tmpRepoDir, repoDir)
89
+ using(archiveUrl.openStream()) { is =>
90
+ using(WrappedZipInputStream .create(new BufferedInputStream (is))) { zis =>
91
+ extractZip(zis, tmpRepoDir)
92
+ }
93
+ }
94
+ os.move(tmpRepoDir, repoDir)
92
95
}
93
96
94
97
val repo = " ivy:" + repoDir.toNIO.toUri.toASCIIString + " /[defaultPattern]"
You can’t perform that action at this time.
0 commit comments