mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Fix test_launcher on Python 2.7.
This commit is contained in:
parent
061f5e9721
commit
bb7375da31
1 changed files with 7 additions and 4 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import errno
|
||||
import os.path
|
||||
import platform
|
||||
import pytest
|
||||
|
|
@ -114,14 +115,16 @@ def test_launcher(pyfile, mode, exit_code, run_as):
|
|||
while not outstr.endswith(b". . . "):
|
||||
outstr += p.stdout.read(1)
|
||||
|
||||
exc_type = BrokenPipeError if sys.version_info >= (3,) else IOError
|
||||
|
||||
while p.poll() is None:
|
||||
try:
|
||||
p.stdin.write(b"\n")
|
||||
p.stdin.flush()
|
||||
except BrokenPipeError:
|
||||
# This can occur if the console exited before
|
||||
# flush was called.
|
||||
pass
|
||||
except exc_type as exc:
|
||||
# This can occur if the process exits before write completes.
|
||||
if isinstance(exc, IOError) and exc.errno != errno.EPIPE:
|
||||
raise
|
||||
else:
|
||||
p.wait()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue