Skip to content

Commit 3113a1f

Browse files
authored
Merge pull request #104 from compnerd/temporary
TSCBasic: improve `TemporaryFile` on Windows
2 parents eeeca0a + 7411034 commit 3113a1f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/TSCBasic/TemporaryFile.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,13 @@ public func withTemporaryFile<Result>(
135135
let tempFile = try TemporaryFile(dir: dir, prefix: prefix, suffix: suffix)
136136
defer {
137137
if deleteOnClose {
138+
#if os(Windows)
139+
_ = tempFile.path.pathString.withCString(encodedAs: UTF16.self) {
140+
_wunlink($0)
141+
}
142+
#else
138143
unlink(tempFile.path.pathString)
144+
#endif
139145
}
140146
}
141147
return try body(tempFile)

0 commit comments

Comments
 (0)