debugpy/tests/logs.py
Pavel Minaev 0d79c16f80 Fix #1711: adapter: access tokens
Generate server access token in enable_attach(), propagate it to the adapter, and have the adapter authenticate to the server via "pydevdAuthorize".

Generate client access token in adapter when not spawned by server, and propagate it to pydevd.

Fix pydevd to correctly propagate access tokens for subprocesses that are not forked.
2019-12-11 20:42:01 -08:00

33 lines
1 KiB
Python

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import io
import os
import pytest_timeout
import sys
from ptvsd.common import log, options
def dump():
if options.log_dir is None:
return
log.info("Dumping logs from {0!j}", options.log_dir)
for dirpath, dirnames, filenames in os.walk(options.log_dir):
for name in sorted(filenames):
if not name.startswith("ptvsd") and not name.startswith("pydevd"):
continue
try:
path = os.path.join(dirpath, name)
with io.open(path, encoding="utf-8", errors="backslashreplace") as f:
s = f.read()
except Exception:
pass
else:
path = os.path.relpath(path, options.log_dir)
pytest_timeout.write_title(path)
print(s, file=sys.stderr)