Expand description
Scratch paths in the machine’s temporary directory.
An external compiler that will not take a pipe needs a file to read or write, and that file belongs to one call: nothing reads it afterwards, and two calls must never share it. Concurrent runs of one tool – a parallel build, a test suite spread over processes, two exports of one project – collide on any name picked by hand, one resetting a path the other is part-way through writing.
So a name here carries the process id and a counter, and is unique for as
long as it names anything. Scratch removes it on drop, which is the half
a hand-rolled path keeps getting wrong: the tool that fails is the one that
returns early, and its intermediates are what stay behind.
This is the only place in the workspace that names the temporary directory.
tests/file_access_discipline.rs holds the rest of the workspace to that.
Structs§
- Scratch
- A scratch path that goes away when this value does.
Functions§
- path
- A path in the machine’s temporary directory, unique to this call.