Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(MODULES-8358) Chunk read the pipe from the PowerShell Process
Previously the PowerShell Manager would attempt all the expected bytes from the inbound pipe. Normally this works fine. However the Travis CI testing was intermittently failing where the pipe was only reading half the pipe, which then caused the first test to fail, and then any subsequent tests failed because it was reading left-over data from the previous failed read. The documentation of the IO.sysread method [1] says the argument is maxlen which implies that this the maximum number of bytes it would return. Note that other methods in IO use the language "Reads at most maxlen bytes from ios" whereas sysread uses the langauge "Reads maxlen bytes from ios" This commit changes the pipe reader to read in chunks of bytes until all of the expected bytes are read. Note that this is a blocking call so if you try to read beyond the bytes in the pipe it blocks the thread. The value of 8K chunk was an arbitrary number which is big enough to get most powershell repsonse in a single IO read. The integration tests were failing to read in a 96K chunk (only ~36K were read) [1] https://ruby-doc.org/core-2.6.1/IO.html#method-i-sysread
- Loading branch information