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 {
213
213
#if os(macOS)
214
214
reportProgress ( . collectingLogMessages( progress: 0 ) , message: " Collecting log messages " )
215
215
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
+ }
217
219
let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
218
220
var bytesCollected = 0
219
221
// 50 MB is an average log size collected by sourcekit-lsp diagnose.
@@ -304,7 +306,9 @@ package struct DiagnoseCommand: AsyncParsableCommand {
304
306
@MainActor
305
307
private func addSwiftVersion( toBundle bundlePath: URL ) async throws {
306
308
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
+ }
308
312
let fileHandle = try FileHandle ( forWritingTo: outputFileUrl)
309
313
310
314
let toolchains = try await toolchainRegistry. toolchains
Original file line number Diff line number Diff line change @@ -471,7 +471,10 @@ package actor SkipUnless {
471
471
. appending ( component: " swift-frontend " )
472
472
return try await withTestScratchDir { scratchDirectory in
473
473
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
+ }
475
478
// If we can't compile for wasm, this fails complaining that it can't find the stdlib for wasm.
476
479
let process = Process (
477
480
args: swiftFrontend. pathString,
You can’t perform that action at this time.
0 commit comments