File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,9 @@ package struct DiagnoseCommand: AsyncParsableCommand {
213213 #if os(macOS)
214214 reportProgress ( . collectingLogMessages( progress: 0 ) , message: " Collecting log messages " )
215215 let outputFileUrl = bundlePath. appendingPathComponent ( " log.txt " )
216- FileManager . default. createFile ( atPath: outputFileUrl. path, contents: nil )
216+ guard FileManager . default. createFile ( atPath: outputFileUrl. path, contents: nil ) else {
217+ throw ReductionError ( " Failed to create log.txt " )
218+ }
217219 let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
218220 var bytesCollected = 0
219221 // 50 MB is an average log size collected by sourcekit-lsp diagnose.
@@ -304,7 +306,9 @@ package struct DiagnoseCommand: AsyncParsableCommand {
304306 @MainActor
305307 private func addSwiftVersion( toBundle bundlePath: URL ) async throws {
306308 let outputFileUrl = bundlePath. appendingPathComponent ( " swift-versions.txt " )
307- FileManager . default. createFile ( atPath: outputFileUrl. path, contents: nil )
309+ guard FileManager . default. createFile ( atPath: outputFileUrl. path, contents: nil ) else {
310+ throw ReductionError ( " Failed to create file at \( outputFileUrl) " )
311+ }
308312 let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
309313
310314 let toolchains = try await toolchainRegistry. toolchains
Original file line number Diff line number Diff line change @@ -471,7 +471,10 @@ package actor SkipUnless {
471471 . appending ( component: " swift-frontend " )
472472 return try await withTestScratchDir { scratchDirectory in
473473 let input = scratchDirectory. appending ( component: " Input.swift " )
474- FileManager . default. createFile ( atPath: input. pathString, contents: nil )
474+ guard FileManager . default. createFile ( atPath: input. pathString, contents: nil ) else {
475+ struct FailedToCrateInputFileError : Error { }
476+ throw FailedToCrateInputFileError ( )
477+ }
475478 // If we can't compile for wasm, this fails complaining that it can't find the stdlib for wasm.
476479 let process = Process (
477480 args: swiftFrontend. pathString,
You can’t perform that action at this time.
0 commit comments