Skip to main content

protect_path

Function protect_path 

Source
pub fn protect_path(path: &Path, mode: u32) -> Result<()>
Expand description

What: Set a path’s permission bits to mode, on Unix only. std::io::Result<()> is “nothing, or an operating-system error”. Why: The creation mode is filtered by the process umask; an explicit change makes the mode exactly private whatever the caller’s umask is, as the incumbent’s protectPath does. Windows keeps its inherited access rules (recorded under “Choices open to veto” in doc/handover/cli-git-native-transactions.md).

In TS you’d write (pseudocode):

if (process.platform !== 'win32') await chmod(path, mode);