| Name | Type | Description |
|---|---|---|
directory* | Path | Directory to create and probe. |
mode | int | Default: 511Permission bits for directories this call creates. The default
|
Create directory and prove the process can write files inside it.
mkdir(exist_ok=True) only proves the directory exists; it succeeds on a
pre-existing root-owned directory. Creating a file is the only check that
distinguishes "present" from "usable".
The probe uses tempfile.mkstemp, not a PID-named file. These directories
are shared across processes, and in the installation-scoped case across
profiles too. PIDs are not unique across containers or PID namespaces: a
colliding name would make a writable directory look unusable and would
delete a peer's live probe. Removal failures are suppressed separately, so
a directory that accepts files but refuses unlinks is still reported as
writable.
Note:
OSError propagates from mkdir or mkstemp when the directory
cannot be created or cannot accept a file. Callers select a fallback
location on that error.