883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
19 lines
1011 B
Python
19 lines
1011 B
Python
#!/usr/bin/env python3
|
|
"""A descendant holds the output descriptors; parent completion must stay prompt."""
|
|
import os,signal,sys,time
|
|
from pathlib import Path
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
from wine_console import run_console
|
|
child="import time; token='gw-console-capture-fixture'; time.sleep(3)"
|
|
parent='import subprocess,sys; p=subprocess.Popen([sys.executable,"-c",'+repr(child)+']); print(p.pid,flush=True)'
|
|
start=time.monotonic();result=run_console([sys.executable,'-c',parent],timeout=2)
|
|
pid=int(result.stdout.strip())
|
|
try:
|
|
assert result.returncode==0 and not result.stderr and time.monotonic()-start<2
|
|
assert Path(f'/proc/{pid}').exists(),'Descendant did not retain the descriptors'
|
|
finally:
|
|
try:
|
|
if b'gw-console-capture-fixture' in Path(f'/proc/{pid}/cmdline').read_bytes():os.kill(pid,signal.SIGTERM)
|
|
except ProcessLookupError:pass
|
|
print('Console capture finishes at owned parent exit, despite a live descendant holding output descriptors.')
|