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