Skip to content

Commit fda8b5c

Browse files
committed
Remove calls to FileHandle.synchronizeFile().
Standard output does not support `fsync`, which is the system call that this boils down to on Linux (and presumably on Darwin as well). In both cases, `fsync` sets `errno` to `EINVAL`, but unfortunately Foundation's behavior differs per platform: on Darwin the error is silently swallowed, but on Linux it traps.
1 parent f40ef5f commit fda8b5c

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

Sources/swift-format/Subcommands/Format.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ private func formatMain(
108108
try bufferData.write(to: assumingFileURL, options: .atomic)
109109
} else {
110110
try formatter.format(source: source, assumingFileURL: assumingFileURL, to: &stdoutStream)
111-
stdoutStream.synchronizeFile()
112111
}
113112
} catch SwiftFormatError.fileNotReadable {
114113
diagnosticEngine.diagnose(
@@ -122,7 +121,6 @@ private func formatMain(
122121
return
123122
}
124123
stdoutStream.write(source)
125-
stdoutStream.synchronizeFile()
126124
return
127125
}
128126
let location = SourceLocationConverter(file: path, source: source).location(for: position)

0 commit comments

Comments
 (0)