tests/readlink.py
author Martin von Zweigbergk <martinvonz@google.com>
Fri, 13 Nov 2020 09:41:49 -0800
changeset 45871 8357e0e81bb7
parent 45849 c102b704edb5
child 48966 6000f5b25c9b
permissions -rwxr-xr-x
split: disable color while rendering template for use in commit message Differential Revision: https://phab.mercurial-scm.org/D9322

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