Mercurial > hg
view tests/readlink.py @ 28788:57a78a64de44
chg: add util function abortmsgerrno to print error with errno
It's common to abortmsg with the errno information. Let's make a utility
function for it.
author | Jun Wu <quark@fb.com> |
---|---|
date | Tue, 05 Apr 2016 17:25:39 +0100 |
parents | 328739ea70c3 |
children | 7bcfb9090c86 |
line wrap: on
line source
#!/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)