Skip to main content

is_null_device

Function is_null_device 

Source
pub fn is_null_device(path: &str) -> bool
Expand description

Is path the platform’s discard device?

The null device is not a location in the filesystem, so a workspace check has nothing to say about it: writing there writes nowhere, and reading there reads nothing. Refusing it produced path '/dev/null' would escape the working directory, which is both wrong and, worse, unactionable - an agent told that spends turns guessing at a path it cannot fix (#373).

Deliberately only the null device, not /dev/stdout or /dev/stderr. Those are the daemon’s own streams once a tool opens them by name, and a tool writing into them would land in the middle of whatever the CLI is drawing. A shell redirect to them stays allowed, because that redirects the child’s streams rather than opening the daemon’s - a different thing that happens to be spelled the same way.