mirror of
https://github.com/rizinorg/rizin.git
synced 2026-10-11 22:19:51 +00:00
* Run http test on Windows * Install `psutil` whenever `requests` is installed * Use `psutil` 6.1.1 on CentOS 7 * Install `python3-devel` on CentOS 7 * Install `py3-psutil` on Alpine * Use `Python314-x64` in `clang_cl_64_dyn` build
31 lines
750 B
Python
Executable File
31 lines
750 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
r"""
|
|
This script kills the http.server launched by http_server.py.
|
|
|
|
"""
|
|
|
|
import re
|
|
import sys
|
|
import psutil
|
|
|
|
http_server_killed = 0
|
|
for p in psutil.process_iter(["cmdline"]):
|
|
try:
|
|
if re.search(r"[Pp]ythonw?3? -m http\.server 9000", " ".join(p.cmdline())):
|
|
p.kill()
|
|
http_server_killed += 1
|
|
if http_server_killed == 2:
|
|
# Not stopping at 1 since what got killed might have been the
|
|
# shell that ran the server
|
|
break
|
|
except (psutil.AccessDenied, psutil.NoSuchProcess):
|
|
pass
|
|
|
|
if http_server_killed > 0:
|
|
print("Killed http.server")
|
|
sys.exit(0)
|
|
else:
|
|
print("ERROR: http.server process not found")
|
|
sys.exit(1)
|