tests/readlink.py
author Raphaël Gomès <rgomes@octobus.net>
Thu, 04 Nov 2021 09:55:37 +0100
branchstable
changeset 48300 809e780c72e5
parent 45830 c102b704edb5
child 48875 6000f5b25c9b
permissions -rwxr-xr-x
relnotes: fix wrong command name in 5.9 relnotes Differential Revision: https://phab.mercurial-scm.org/D11735

#!/usr/bin/env python3

from __future__ import absolute_import, print_function

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)