MCPcopy Create free account
hub / github.com/tox-dev/filelock / _write_lock_info

Method _write_lock_info

src/filelock/_soft.py:107–114  ·  view source on GitHub ↗
(fd: int)

Source from the content-addressed store, hash-verified

105
106 @staticmethod
107 def _write_lock_info(fd: int) -> None:
108 # No suppression: a write failure must reach the acquisition rollback so it never publishes a half-written
109 # marker as held state. The optional third line is this process's start token, absent when the platform
110 # exposes no proven start time, in which case a reader falls back to PID-only liveness.
111 info = f"{os.getpid()}\n{host_name()}\n"
112 if (token := process_start_token(os.getpid())) is not None:
113 info += f"{token}\n"
114 write_all(fd, info.encode())
115
116 @property
117 def pid(self) -> int | None:

Callers 1

_publish_held_markerMethod · 0.95

Calls 3

host_nameFunction · 0.85
process_start_tokenFunction · 0.85
write_allFunction · 0.85

Tested by

no test coverage detected