tests/readlink.py
author Siddharth Agarwal <sid0@fb.com>
Fri, 25 Sep 2015 12:28:12 -0700
changeset 26439 b50f5beadf3e
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
localrepo: allow creating inherited locks This is part of a series that will allow locks to be inherited by subprocesses in limited circumstances.

#!/usr/bin/env python

import errno, os, 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, 'not a symlink'

sys.exit(0)