readlink.py
15 lines
| 295 B
| text/x-python
|
PythonLexer
/ tests / readlink.py
Thomas Arendsen Hein
|
r5683 | #!/usr/bin/env python | ||
timeless
|
r29175 | from __future__ import print_function | ||
Thomas Arendsen Hein
|
r5683 | import errno, os, sys | ||
for f in sys.argv[1:]: | ||||
try: | ||||
timeless
|
r29175 | print(f, '->', os.readlink(f)) | ||
Gregory Szorc
|
r25660 | except OSError as err: | ||
Matt Mackall
|
r10282 | if err.errno != errno.EINVAL: | ||
raise | ||||
timeless
|
r29175 | print(f, '->', f, 'not a symlink') | ||
Thomas Arendsen Hein
|
r5683 | |||
sys.exit(0) | ||||