feat(plugins): add source-aware evidence and recording timelines

This commit is contained in:
chenmingxuan committed 2026-10-16 10:20:11 +08:00
1 parent 72ff342605
commit ef7af9988e
61 files changed
+3847 -108

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
"""Exercise Windows ownership without recording a user screen or running FFmpeg."""
import os
from pathlib import Path
import subprocess
import sys
import time
import psutil
import pytest
@pytest.mark.skipif(os.name != "nt", reason="Windows capture process ownership")
def test_worker_exit_terminates_owned_capture_child():
project = str(Path(__file__).resolve().parents[2])
script = f"""
import os, subprocess, sys
sys.path.insert(0, {project!r})
from artemis.plugins.recording_process import CaptureProcessJob
job = CaptureProcessJob()
child = subprocess.Popen([sys.executable, '-c', 'import time; time.sleep(120)'],
creationflags=0x08000000, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
job.assign(child.pid)
print(child.pid, flush=True)
os._exit(0)
"""
parent = subprocess.run(
[sys.executable, "-c", script],
capture_output=True,
text=True,
timeout=15,
creationflags=0x08000000,
check=True,
)
pid = int(parent.stdout.strip())
for _ in range(50):
if not psutil.pid_exists(pid):
return
time.sleep(0.1)
# Only the disposable child created above is eligible for cleanup.
psutil.Process(pid).kill()
pytest.fail("Owned capture child survived abrupt worker exit")