From 8aa0acb9e8260c2713cabb8407a30ae54f6eebb5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 6 Oct 2025 13:25:33 +0200 Subject: [PATCH] Don't build getPtsName() on Windows It's not needed. https://hydra.nixos.org/build/309215536 --- src/libutil/terminal.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libutil/terminal.cc b/src/libutil/terminal.cc index 656847487..fe22146ab 100644 --- a/src/libutil/terminal.cc +++ b/src/libutil/terminal.cc @@ -179,9 +179,10 @@ std::pair getWindowSize() return *windowSize.lock(); } +#ifndef _WIN32 std::string getPtsName(int fd) { -#ifdef __APPLE__ +# ifdef __APPLE__ static std::mutex ptsnameMutex; // macOS doesn't have ptsname_r, use mutex-protected ptsname std::lock_guard lock(ptsnameMutex); @@ -190,7 +191,7 @@ std::string getPtsName(int fd) throw SysError("getting pseudoterminal slave name"); } return name; -#else +# else // Use thread-safe ptsname_r on platforms that support it // PTY names are typically short: // - Linux: /dev/pts/N (where N is usually < 1000) @@ -201,7 +202,8 @@ std::string getPtsName(int fd) throw SysError("getting pseudoterminal slave name"); } return buf; -#endif +# endif } +#endif } // namespace nix