readlink.py
17 lines
| 324 B
| text/x-python
|
PythonLexer
/ tests / readlink.py
Thomas Arendsen Hein
|
r5683 | #!/usr/bin/env python | ||
Pulkit Goyal
|
r29485 | from __future__ import absolute_import, print_function | ||
timeless
|
r29175 | |||
Pulkit Goyal
|
r29485 | import errno | ||
import os | ||||
import sys | ||||
Thomas Arendsen Hein
|
r5683 | |||
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) | ||||