================ @@ -274,7 +276,23 @@ int NativeFile::GetDescriptor() const { } IOObject::WaitableHandle NativeFile::GetWaitableHandle() { +#ifdef _WIN32 + return (HANDLE)_get_osfhandle(GetDescriptor()); +#else return GetDescriptor(); +#endif +} + +bool NativeFile::HasReadableData() { +#ifdef _WIN32 + DWORD available_bytes = 0; + return !PeekNamedPipe((HANDLE)_get_osfhandle(GetDescriptor()), NULL, 0, NULL, ---------------- labath wrote:
That's better, but I do have a question, and a comment :) - Do we need to support selecting on actual files? That doesn't even work on posix systems (the file just always comes back as "readable" -- which makes sense because select just tells you whether the operation will block), so if anything, I think we should emulate that. Waiting for file modification requires things like inotify(7), and fortunately, noone has had a use case for that for now. If we ever needed to support it, that should probably be a separate kind of an event. I'm assuming that `GetFileType` on a pipe handle will return `FILE_TYPE_PIPE`, even if that handle was passed as `stdin`. - it my long term vision, I would like lldb-dap to create Pipe IOObject directly (perhaps via some helper on the File class) instead of having the MainLoop class guess it. However, given that Pipe is not an IOObject right now, this is something I can live with. https://github.com/llvm/llvm-project/pull/145621 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits