tests/readlink.py
author Gregory Szorc <gregory.szorc@gmail.com>
Sun, 29 Mar 2020 14:31:59 -0700
changeset 44657 47e6ec977555
parent 29485 6a98f9408a50
child 45849 c102b704edb5
permissions -rwxr-xr-x
tests: prevent printing \r to stdout Like we've done in other recent commits, we need to change sys.stdout on Python 3 to not use os.linesep so output is consistent on Python 3 on Windows. With this change, test-notify.t now passes on Python 3 on Windows! Differential Revision: https://phab.mercurial-scm.org/D8342

#!/usr/bin/env python

from __future__ import absolute_import, print_function

import errno
import os
import 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, '->', f, 'not a symlink')

sys.exit(0)