Skip to content

Commit 1cfdeb3

Browse files
author
yicheng
committed
ParseHandlesAndSetCloexec on window should return HANDLEs
Signed-off-by: yicheng <[email protected]>
1 parent 222b544 commit 1cfdeb3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

python/ray/_private/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2425,7 +2425,7 @@ def start_ray_client_server(
24252425
stderr_file=stderr_file,
24262426
fate_share=fate_share,
24272427
pass_handles=[runtime_env_agent_port_read_handle]
2428-
if runtime_env_agent_port_read_handle
2428+
if runtime_env_agent_port_read_handle is not None
24292429
else None,
24302430
)
24312431
return process_info

src/ray/util/pipe.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class Pipe {
211211
CloseWriterHandle();
212212
}
213213

214-
/// Parse comma-separated writer handles, set close-on-exec, return as fds.
214+
/// Parse comma-separated handles and set close-on-exec.
215215
static std::vector<intptr_t> ParseHandlesAndSetCloexec(const std::string &handles_str) {
216216
std::vector<intptr_t> result;
217217
if (handles_str.empty()) return result;
@@ -222,8 +222,8 @@ class Pipe {
222222
if (token.empty()) continue;
223223
#ifdef _WIN32
224224
intptr_t handle = static_cast<intptr_t>(std::stoll(token));
225-
int fd = OpenHandleAsFd(handle, _O_BINARY | _O_WRONLY);
226-
if (fd >= 0) result.push_back(static_cast<intptr_t>(fd));
225+
SetHandleInformation(reinterpret_cast<HANDLE>(handle), HANDLE_FLAG_INHERIT, 0);
226+
result.push_back(handle);
227227
#else
228228
int fd = std::stoi(token);
229229
SetFdCloseOnExec(fd);

0 commit comments

Comments
 (0)