| 18 | resource.setrlimit(resource.RLIMIT_NOFILE, (7, 7)) |
| 19 | |
| 20 | def launch(args, *positional, **keywords): |
| 21 | selected = (isinstance(args, (list, tuple)) and len(args) == 2 |
| 22 | and os.fspath(args[0]) == runner and os.fspath(args[1]) == suite) |
| 23 | if selected: |
| 24 | if keywords.get("preexec_fn") is not None: |
| 25 | raise RuntimeError("native fault boundary already has a pre-exec callback") |
| 26 | keywords["preexec_fn"] = nofile |
| 27 | process = original(args, *positional, **keywords) |
| 28 | if selected: |
| 29 | children.append((process, {"pid": process.pid, "argv": list(args), |
| 30 | "rlimit_nofile": 7, |
| 31 | "start_new_session": keywords.get("start_new_session", False)})) |
| 32 | return process |
| 33 | |
| 34 | subprocess.Popen = launch |
| 35 | sys.path.insert(0, str(Path(collector).parent)) |