Conversation
afbb0e7 to
99d9d11
Compare
|
Both before and after this PR, Because |
99d9d11 to
9c75d45
Compare
We don't have the dirFd on window at this time.
There are other types of sockets.
9c75d45 to
5a9de16
Compare
src/nix/unix/daemon.cc
Outdated
| Socket fromSock = toSocket(from), stdinSock = getStandardInput(); | ||
| auto nfds = std::max(fromSock, stdinSock) + 1; | ||
| while (true) { | ||
| fd_set fds; | ||
| FD_ZERO(&fds); | ||
| FD_SET(from, &fds); | ||
| FD_SET(STDIN_FILENO, &fds); | ||
| FD_SET(fromSock, &fds); | ||
| FD_SET(stdinSock, &fds); | ||
| if (select(nfds, &fds, nullptr, nullptr, nullptr) == -1) | ||
| throw SysError("waiting for data from client or server"); | ||
| if (FD_ISSET(from, &fds)) { | ||
| if (FD_ISSET(fromSock, &fds)) { | ||
| auto res = splice(from, nullptr, STDOUT_FILENO, nullptr, SSIZE_MAX, SPLICE_F_MOVE); | ||
| if (res == -1) | ||
| throw SysError("splicing data from daemon socket to stdout"); | ||
| else if (res == 0) | ||
| throw EndOfFile("unexpected EOF from daemon socket"); | ||
| } | ||
| if (FD_ISSET(STDIN_FILENO, &fds)) { | ||
| if (FD_ISSET(stdinSock, &fds)) { |
There was a problem hiding this comment.
Technically won't really work on windows, since select is socket-only, but at we'll probably need a better primitive to abstract away this kind of operation for pipes.
These functions use `SOCKET` not `int`, despite them being unix functions.
5a9de16 to
208ed3c
Compare
xokdvium
left a comment
There was a problem hiding this comment.
Makes the usage slightly more correct. Would be nice to have unit tests for this though.
|
@xokdvium Windows unit tests will be done once it's fully working at the moment our goal is just to get it working and then worry about unit-tests later on. |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin 2.33-maintenance
git worktree add -d .worktree/backport-14817-to-2.33-maintenance origin/2.33-maintenance
cd .worktree/backport-14817-to-2.33-maintenance
git switch --create backport-14817-to-2.33-maintenance
git cherry-pick -x 30cd9e43e1bbf0ccb8d4e131988ac9eeb6e3dab3 79750a3ccc103f670a3db72bddf64aeb576ef36b 208ed3c538e9ea2f4027b6976c4f689ba28035fd |
Well, how does you know if it works or not without unit tests? When it comes to this sort of sneaky OS API usage its imposssible to get right consistently without any unit tests |
Like right when I tested it doesn't even know the file format of it compiling via debuging via gcc. Like try testing |
Motivation
See each commit for details
Context
This will hopefully fix msys2/MINGW-packages#22499 . Clang had Identified we were missing a cast between
HANDLEandSOCKET.Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.