From 3f86ebf1ed4908ad0735a190b239e3f3bcbf4cef Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 10 Feb 2022 19:35:11 -0500 Subject: OSX CI Test (#2126) * #include an absolute path didn't work - because paths were taken to always be relative. * Small fixes. Added compiler crash with generic defined in a function. Added enum-flags test that works (by limiting backing type to int), and using __EnumType constraint. * Add comment about crash. * Disable crashing test. * Fixes to make compile on OSX. * Add github build for OSX. * Make premake generator a utility. * Fix osx compilation issue. * More fixes for OSX build. * OSX fix due to ambiguity around size_t and integer types. * Disable xlib on build on osx. * Use 'prebuildcommands' to make prebuild make utility projects do something. * Small fixes for premake so utility works on linux/osx. * Another hack to try and make generators run when 'utility' * Fix typo in macos.yml. * Revert premake to old style, and disable stdlib embedding on OSX. * OSX testing. * Fix pipe handling for OSX. * Enable testing on OSX. * Small fix because uname -p is not x64 on darwin. --- source/core/unix/slang-unix-process.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'source/core') diff --git a/source/core/unix/slang-unix-process.cpp b/source/core/unix/slang-unix-process.cpp index 991d905d9..2275238d9 100644 --- a/source/core/unix/slang-unix-process.cpp +++ b/source/core/unix/slang-unix-process.cpp @@ -261,6 +261,12 @@ SlangResult UnixPipeStream::read(void* buffer, size_t length, size_t& outReadByt return SLANG_FAIL; } + // If there are no poll events, we are done + if (pollResult == 0) + { + return SLANG_OK; + } + // If there is data read that first if (pollInfo.revents & POLLIN) { @@ -281,7 +287,16 @@ SlangResult UnixPipeStream::read(void* buffer, size_t length, size_t& outReadByt } outReadBytes = size_t(count); - return SLANG_OK; + + // If no bytes were wanted, then there could still be bytes in the pipe + // before a HUP. So don't fall through to check for HUP. + // + // If some bytes *were* wanted and none were read, we can allow fall through to + // handle HUP. + if (length == 0 || count > 0) + { + return SLANG_OK; + } } if (pollInfo.revents & POLLHUP) -- cgit v1.2.3