Fix crashes that could occur when detecting file mimetypes.
Review Request #14229 — Created Nov. 5, 2024 and updated — Latest diff uploaded
This change mirrors a similar fix that we recently did for Review Board.
This fixes two issues with RBTools' MIME-type detection:
Some versions of Python break if you try to close an already-closed
pipe, and this had happened on one customer's machine.file
may
close the input stream once it's read enough data to make a
determination, and our attempt to close would then fail.Errors executing or communicating with
file
would crash.
Ran unit tests.