Skip to content

Commit 35b3557

Browse files
authored
Merge pull request #14162 from NixOS/fix-windows-build
Don't build getPtsName() on Windows
2 parents 5e65584 + 8aa0acb commit 35b3557

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/libutil/terminal.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,10 @@ std::pair<unsigned short, unsigned short> getWindowSize()
179179
return *windowSize.lock();
180180
}
181181

182+
#ifndef _WIN32
182183
std::string getPtsName(int fd)
183184
{
184-
#ifdef __APPLE__
185+
# ifdef __APPLE__
185186
static std::mutex ptsnameMutex;
186187
// macOS doesn't have ptsname_r, use mutex-protected ptsname
187188
std::lock_guard<std::mutex> lock(ptsnameMutex);
@@ -190,7 +191,7 @@ std::string getPtsName(int fd)
190191
throw SysError("getting pseudoterminal slave name");
191192
}
192193
return name;
193-
#else
194+
# else
194195
// Use thread-safe ptsname_r on platforms that support it
195196
// PTY names are typically short:
196197
// - Linux: /dev/pts/N (where N is usually < 1000)
@@ -201,7 +202,8 @@ std::string getPtsName(int fd)
201202
throw SysError("getting pseudoterminal slave name");
202203
}
203204
return buf;
204-
#endif
205+
# endif
205206
}
207+
#endif
206208

207209
} // namespace nix

0 commit comments

Comments
 (0)