MCPcopy Index your code
hub / github.com/RustPython/RustPython / _chmod

Function _chmod

crates/vm/src/stdlib/posix.rs:1211–1228  ·  view source on GitHub ↗
(
        path: OsPath,
        dir_fd: DirFd<'_, 0>,
        mode: u32,
        follow_symlinks: FollowSymlinks,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

1209 }
1210
1211 fn _chmod(
1212 path: OsPath,
1213 dir_fd: DirFd<'_, 0>,
1214 mode: u32,
1215 follow_symlinks: FollowSymlinks,
1216 vm: &VirtualMachine,
1217 ) -> PyResult<()> {
1218 let [] = dir_fd.0;
1219 let err_path = path.clone();
1220 let body = move || {
1221 use std::os::unix::fs::PermissionsExt;
1222 let meta = fs_metadata(&path, follow_symlinks.0)?;
1223 let mut permissions = meta.permissions();
1224 permissions.set_mode(mode);
1225 fs::set_permissions(&path, permissions)
1226 };
1227 body().map_err(|err| OSErrorBuilder::with_filename(&err, err_path, vm))
1228 }
1229
1230 #[cfg(not(target_os = "redox"))]
1231 fn _fchmod(fd: BorrowedFd<'_>, mode: u32, vm: &VirtualMachine) -> PyResult<()> {

Callers 1

chmodFunction · 0.85

Calls 2

fs_metadataFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected