existsSync should never throw ENAMETOOLONG (#10446)

* existsSync should never throw ENAMETOOLONG

* undo PathLike change and use better guard

* Apply formatting changes

* await promise

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred-Sumner <Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Meghan Denny
2024-04-23 15:33:37 -07:00
committed by GitHub
parent c1d7a5ed79
commit ff624147ad
5 changed files with 29 additions and 8 deletions

View File

@@ -1305,6 +1305,10 @@ pub const SliceWithUnderlyingString = struct {
return this.utf8.slice();
}
pub fn sliceZ(this: SliceWithUnderlyingString) [:0]const u8 {
return this.utf8.sliceZ();
}
pub fn format(self: SliceWithUnderlyingString, comptime fmt: []const u8, opts: std.fmt.FormatOptions, writer: anytype) !void {
if (self.utf8.len == 0) {
try self.underlying.format(fmt, opts, writer);