Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: resolve deadlock in LatestOsVersion#version_for_os
LatestOsVersion#version_for_os can be catched in a deadlock when used with Xcode 13.3.0 or later while a device is physically connected to the computer. In this case, xcodebuild will return a few lines of errors on stderr which will trigger a deadlock in Open3#open3. The problem is mentioned explicitely in the documentation of Open3#open3: > You should be careful to avoid deadlocks. Since pipes are fixed > length buffer, #popen3(“prog”) {|i, o, e, t| o.read } deadlocks if > the program generates many output on stderr. You should be read > stdout and stderr simultaneously (using thread or IO.select). However > if you don't need stderr output, #popen2 can be used. If merged > stdout and stderr output is not a problem, you can use #popen2e. > If you really needs stdout and stderr output as separate strings, > you can consider #capture3. Using Open3#capture2 or Open3#open2 would show the error in the terminal, but Open3#capture3 allows us to capture only stdout and hide stderr from the users eyes.
- Loading branch information