tests/readlink.py
author Rapha?l Gom?s <rgomes@octobus.net>
Mon, 04 Nov 2024 15:28:32 +0100
changeset 52309 56e8841a454c
parent 48875 6000f5b25c9b
permissions -rwxr-xr-x
rust: remove `atty` dependency It is fully replaced with the now stable `std::io::IsTerminal` trait. This was the last dependency flagged as a warning by `cargo audit`, aside from `cpython` which we know about all too well: the plan is to transition to PyO3 soon-ish.

#!/usr/bin/env python3


import errno
import os
import sys

for f in sys.argv[1:]:
    try:
        print(f, '->', os.readlink(f))
    except OSError as err:
        if err.errno != errno.EINVAL:
            raise
        print(f, '->', f, 'not a symlink')

sys.exit(0)