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

Function _spawn_daemon

pymongo/daemon.py:61–78  ·  view source on GitHub ↗

Spawn a daemon process (Windows).

(args: Sequence[str])

Source from the content-addressed store, hash-verified

59 _DETACHED_PROCESS = getattr(subprocess, "DETACHED_PROCESS", 0x00000008)
60
61 def _spawn_daemon(args: Sequence[str]) -> None:
62 """Spawn a daemon process (Windows)."""
63 try:
64 with open(os.devnull, "r+b") as devnull:
65 popen = subprocess.Popen(
66 args, # noqa: S603
67 creationflags=_DETACHED_PROCESS,
68 stdin=devnull,
69 stderr=devnull,
70 stdout=devnull,
71 )
72 _silence_resource_warning(popen)
73 except FileNotFoundError as exc:
74 warnings.warn(
75 f"Failed to start {args[0]}: is it on your $PATH?\nOriginal exception: {exc}",
76 RuntimeWarning,
77 stacklevel=2,
78 )
79
80else:
81 # On Unix we spawn the daemon process with a double Popen.

Callers 4

start_mongocryptdFunction · 0.90
start_mongocryptdFunction · 0.90
spawnMethod · 0.90
spawnMethod · 0.90

Calls 3

_spawnFunction · 0.85

Tested by 2

start_mongocryptdFunction · 0.72
start_mongocryptdFunction · 0.72