| 1 |
import http.server |
| 2 |
import os |
| 3 |
import subprocess |
| 4 |
import sys |
| 5 |
import threading |
| 6 |
|
| 7 |
|
| 8 |
class TrivialHandler(http.server.BaseHTTPRequestHandler): |
| 9 |
def do_GET(self): |
| 10 |
self.send_response(501) |
| 11 |
|
| 12 |
def log_request(self, *args, **kwargs): |
| 13 |
print(self.requestline) |
| 14 |
print(self.headers) |
| 15 |
|
| 16 |
|
| 17 |
httpd = http.server.HTTPServer(("", 0), TrivialHandler) |
| 18 |
port = httpd.socket.getsockname()[1] |
| 19 |
|
| 20 |
try: |
| 21 |
t = threading.Thread(target=httpd.serve_forever).start() |
| 22 |
os.environ["DEBUGINFOD_URLS"] = f"http://localhost:{port}" |
| 23 |
subprocess.run(sys.argv[1:], capture_output=True) |
| 24 |
finally: |
| 25 |
httpd.shutdown() |