cap-std-sync: my set_fd_flags idea didnt seem to work?

This commit is contained in:
Pat Hickey
2021-02-01 12:42:31 -08:00
parent bad169dde3
commit 8b9d2c5bbb

View File

@@ -71,7 +71,16 @@ impl WasiDir for Dir {
// (DSYNC, SYNC, NONBLOCK, RSYNC) // (DSYNC, SYNC, NONBLOCK, RSYNC)
// ideally OpenOptions would just support this though: // ideally OpenOptions would just support this though:
// https://github.com/bytecodealliance/cap-std/issues/146 // https://github.com/bytecodealliance/cap-std/issues/146
f.set_fd_flags(to_sysif_fdflags(fdflags))?; {
// Even worse - set_fd_flags panicks when given DSYNC, SYNC, RSYNC!
// it only supports NONBLOCK
let fdflags = if fdflags.contains(wasi_common::file::FdFlags::NONBLOCK) {
system_interface::fs::FdFlags::NONBLOCK
} else {
system_interface::fs::FdFlags::empty()
};
f.set_fd_flags(fdflags)?;
}
Ok(Box::new(File::from_cap_std(f))) Ok(Box::new(File::from_cap_std(f)))
} }