Spawn the process and silence stdout/stderr.
(args: Sequence[str])
| 90 | # avoids triggering the application's os.register_at_fork() callbacks when |
| 91 | # we spawn the mongocryptd daemon process. |
| 92 | def _spawn(args: Sequence[str]) -> Optional[subprocess.Popen[Any]]: |
| 93 | """Spawn the process and silence stdout/stderr.""" |
| 94 | try: |
| 95 | with open(os.devnull, "r+b") as devnull: |
| 96 | return subprocess.Popen( |
| 97 | args, # noqa: S603 |
| 98 | close_fds=True, |
| 99 | stdin=devnull, |
| 100 | stderr=devnull, |
| 101 | stdout=devnull, |
| 102 | ) |
| 103 | except FileNotFoundError as exc: |
| 104 | warnings.warn( |
| 105 | f"Failed to start {args[0]}: is it on your $PATH?\nOriginal exception: {exc}", |
| 106 | RuntimeWarning, |
| 107 | stacklevel=2, |
| 108 | ) |
| 109 | return None |
| 110 | |
| 111 | def _spawn_daemon_double_popen(args: Sequence[str]) -> None: |
| 112 | """Spawn a daemon process using a double subprocess.Popen.""" |
no outgoing calls
no test coverage detected