tests/readlink.py
author Raphaël Gomès <rgomes@octobus.net>
Tue, 02 Jun 2020 17:24:37 +0200
changeset 44976 2093b2fc70d4
parent 29485 6a98f9408a50
child 45849 c102b704edb5
permissions -rwxr-xr-x
rust-dependencies: upgrade `micro-timer` dependency I wanted to to a tour of dependencies to upgrade, but only `micro-timer` has a new release which does not print when the function panics, which should be less misleading. Differential Revision: https://phab.mercurial-scm.org/D8605

#!/usr/bin/env python

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)