1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

Merge pull request #13283 from NixOS/fix-mingw

Fix mingw build
This commit is contained in:
John Ericson 2025-05-28 12:31:56 -04:00 committed by GitHub
commit cc926c332c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 9 additions and 9 deletions

View file

@ -2,6 +2,8 @@
#include <cstdio> #include <cstdio>
#include <signal.h>
#if USE_READLINE #if USE_READLINE
#include <readline/history.h> #include <readline/history.h>
#include <readline/readline.h> #include <readline/readline.h>

View file

@ -137,7 +137,7 @@ public:
: state(state) : state(state)
, sampleInterval(period) , sampleInterval(period)
, profileFd([&]() { , profileFd([&]() {
AutoCloseFD fd = toDescriptor(open(profileFile.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0660)); AutoCloseFD fd = toDescriptor(open(profileFile.string().c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0660));
if (!fd) if (!fd)
throw SysError("opening file %s", profileFile); throw SysError("opening file %s", profileFile);
return fd; return fd;

View file

@ -80,7 +80,7 @@ void bind(Socket fd, const std::string & path);
/** /**
* Connect to a Unix domain socket. * Connect to a Unix domain socket.
*/ */
void connect(Socket fd, const std::string & path); void connect(Socket fd, const std::filesystem::path & path);
/** /**
* Connect to a Unix domain socket. * Connect to a Unix domain socket.

View file

@ -324,7 +324,7 @@ std::unique_ptr<Logger> makeJSONLogger(const std::filesystem::path & path, bool
AutoCloseFD fd = AutoCloseFD fd =
std::filesystem::is_socket(path) std::filesystem::is_socket(path)
? connect(path) ? connect(path)
: toDescriptor(open(path.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0644)); : toDescriptor(open(path.string().c_str(), O_CREAT | O_APPEND | O_WRONLY, 0644));
if (!fd) if (!fd)
throw SysError("opening log file %1%", path); throw SysError("opening log file %1%", path);

View file

@ -29,7 +29,6 @@ AutoCloseFD createUnixDomainSocket()
return fdSocket; return fdSocket;
} }
AutoCloseFD createUnixDomainSocket(const Path & path, mode_t mode) AutoCloseFD createUnixDomainSocket(const Path & path, mode_t mode)
{ {
auto fdSocket = nix::createUnixDomainSocket(); auto fdSocket = nix::createUnixDomainSocket();
@ -100,7 +99,6 @@ static void bindConnectProcHelper(
} }
} }
void bind(Socket fd, const std::string & path) void bind(Socket fd, const std::string & path)
{ {
unlink(path.c_str()); unlink(path.c_str());
@ -108,10 +106,9 @@ void bind(Socket fd, const std::string & path)
bindConnectProcHelper("bind", ::bind, fd, path); bindConnectProcHelper("bind", ::bind, fd, path);
} }
void connect(Socket fd, const std::filesystem::path & path)
void connect(Socket fd, const std::string & path)
{ {
bindConnectProcHelper("connect", ::connect, fd, path); bindConnectProcHelper("connect", ::connect, fd, path.string());
} }
AutoCloseFD connect(const std::filesystem::path & path) AutoCloseFD connect(const std::filesystem::path & path)

View file

@ -1,4 +1,5 @@
#include "nix/util/file-system.hh" #include "nix/util/file-system.hh"
#include "nix/util/logging.hh"
#ifdef _WIN32 #ifdef _WIN32
namespace nix { namespace nix {

View file

@ -92,7 +92,7 @@ struct CmdFormatterRun : MixFormatter, MixJSON
// Add the path to the flake as an environment variable. This enables formatters to format the entire flake even // Add the path to the flake as an environment variable. This enables formatters to format the entire flake even
// if run from a subdirectory. // if run from a subdirectory.
StringMap env = getEnv(); StringMap env = getEnv();
env["PRJ_ROOT"] = flakeDir; env["PRJ_ROOT"] = flakeDir.string();
// Release our references to eval caches to ensure they are persisted to disk, because // Release our references to eval caches to ensure they are persisted to disk, because
// we are about to exec out of this process without running C++ destructors. // we are about to exec out of this process without running C++ destructors.