tests/readlink.py
author Matt Mackall <mpm@selenic.com>
Thu, 28 Apr 2016 15:40:43 -0500
branchstable
changeset 29039 e3055b46ed1b
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
tags: silence hgtagsfnodes reading failures tryread() doesn't handle "is a directory" errors and presumably others. We might not want to globally swallow such tryread errors, so we replace with our own try/except handling. An upcoming test will use directories as a portable stand-in for various bizarre circumstances that cache read/write code should be robust to.

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