tests/readlink.py
author Raphaël Gomès <rgomes@octobus.net>
Mon, 23 Jan 2023 18:52:05 +0100
changeset 50760 b584dae08774
parent 48875 6000f5b25c9b
permissions -rwxr-xr-x
configitems: add `documentation` field It may be useful to expose documentation information in the help in some form. This will be populated in a future changeset by using the current comments that are relevant for users.

#!/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)