Fix issues working with stdin when piping to Python.
Review Request #13555 — Created Feb. 18, 2024 and submitted
We hit an issue before where piping the installer to Python would give
us a useless stdin. I had thought this was fixed, but I've still hit
errors with the new code here.First off, in the cases I've tested locally, stdin isn't coming up as a
TTY, which just means none of this worked. In my past tests, it did.
This might be dependent on Python in some way. I'm not sure.The solution here is to re-open stdin as a TTY. This gives us back full
input from the terminal, and seems to be the standard practice (though
time will tell if there are gotchas).Second, querying for terminal info could fail. We now check for
exceptions here and just fall back to an empty result.
Tested running the installer manually, via
curl | python
, and via
cat | python
on both macOS and Linux (over SSH). Verified I was able
to run the installer, provide input that the installer could work with,
and that the terminal queries continued to work (including detecting light
backgrounds).
Summary | ID |
---|---|
0e0d08f012478d39f21d643d8e9b0489ffc7def6 |