Issue #15478: Fix test_os on FreeBSD

Calling OS functions can fail with errors other than FileNotFoundError: a
FreeBSD buildbot fails for example with a PermissionError.
1 file changed