File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -249,12 +249,12 @@ class TestNSTask : XCTestCase {
249
249
250
250
private func mkstemp( template: String , body: ( FileHandle ) throws -> Void ) rethrows {
251
251
let url = URL ( fileURLWithPath: NSTemporaryDirectory ( ) ) . appendingPathComponent ( " TestNSTask.XXXXXX " )
252
- var buffer = [ Int8 ] ( repeating : 0 , count : Int ( PATH_MAX ) )
252
+
253
253
try url. withUnsafeFileSystemRepresentation {
254
- switch mkstemp ( UnsafeMutablePointer ( mutating: $0) ) {
254
+ switch mkstemp ( UnsafeMutablePointer ( mutating: $0! ) ) {
255
255
case - 1 : XCTFail ( " Could not create temporary file " )
256
256
case let fd:
257
- defer { unlink ( & buffer ) }
257
+ defer { url . withUnsafeFileSystemRepresentation { _ = unlink ( $0! ) } }
258
258
try body ( FileHandle ( fileDescriptor: fd, closeOnDealloc: true ) )
259
259
}
260
260
}
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ class TestNSURL : XCTestCase {
243
243
let cwdURL = URL ( fileURLWithPath: cwd, isDirectory: true )
244
244
// 1 for path separator
245
245
cwdURL. withUnsafeFileSystemRepresentation {
246
- gRelativeOffsetFromBaseCurrentWorkingDirectory = UInt ( strlen ( $0) + 1 )
246
+ gRelativeOffsetFromBaseCurrentWorkingDirectory = UInt ( strlen ( $0! ) + 1 )
247
247
}
248
248
249
249
You can’t perform that action at this time.
0 commit comments