Silence Popen's ResourceWarning. Note this should only be used if the process was created as a daemon.
(popen: Optional[subprocess.Popen[Any]])
| 41 | |
| 42 | |
| 43 | def _silence_resource_warning(popen: Optional[subprocess.Popen[Any]]) -> None: |
| 44 | """Silence Popen's ResourceWarning. |
| 45 | |
| 46 | Note this should only be used if the process was created as a daemon. |
| 47 | """ |
| 48 | # Set the returncode to avoid this warning when popen is garbage collected: |
| 49 | # "ResourceWarning: subprocess XXX is still running". |
| 50 | # See https://bugs.python.org/issue38890 and |
| 51 | # https://bugs.python.org/issue26741. |
| 52 | # popen is None when mongocryptd spawning fails |
| 53 | if popen is not None: |
| 54 | popen.returncode = 0 |
| 55 | |
| 56 | |
| 57 | if sys.platform == "win32": |
no outgoing calls
no test coverage detected