MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _spawn

Function _spawn

pymongo/daemon.py:92–109  ·  view source on GitHub ↗

Spawn the process and silence stdout/stderr.

(args: Sequence[str])

Source from the content-addressed store, hash-verified

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."""

Callers 2

_spawn_daemonFunction · 0.85
daemon.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected