authorgravatar for r00ster91@protonmail.comr00ster <r00ster91@protonmail.com> 2022-04-12 11:32:45+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-04-12 05:32:45-04:00
log988afd51cd34649887f493b6ac9e05fcaa1f768d
treedb1bddd7890534f4eb23d53061aa9d970db7dc9c
parentd2681d2537b630359657e117ed77cf12a15bb7df
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Add `std.fs.File.sync` (#11410)


1 files changed, 11 insertions(+), 0 deletions(-)

lib/std/fs/file.zig+11
...@@ -200,6 +200,17 @@ pub const File = struct {...@@ -200,6 +200,17 @@ pub const File = struct {
200 }200 }
201 }201 }
202202
203 pub const SyncError = os.SyncError;
204
205 /// Blocks until all pending file contents and metadata modifications
206 /// for the file have been synchronized with the underlying filesystem.
207 ///
208 /// Note that this does not ensure that metadata for the
209 /// directory containing the file has also reached disk.
210 pub fn sync(self: File) SyncError!void {
211 return os.fsync(self.handle);
212 }
213
203 /// Test whether the file refers to a terminal.214 /// Test whether the file refers to a terminal.
204 /// See also `supportsAnsiEscapeCodes`.215 /// See also `supportsAnsiEscapeCodes`.
205 pub fn isTty(self: File) bool {216 pub fn isTty(self: File) bool {