mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-03 09:42:22 +00:00
core: fix completion darwin io
This commit is contained in:
parent
82ee0e4a00
commit
38c407a286
1 changed files with 10 additions and 3 deletions
|
@ -67,7 +67,11 @@ impl IO for DarwinIO {
|
|||
match cf {
|
||||
CompletionCallback::Read(ref file, ref c, pos) => {
|
||||
let mut file = file.borrow_mut();
|
||||
let mut buf = c.buf_mut();
|
||||
let r = match &(*c) {
|
||||
Completion::Read(r) => r,
|
||||
Completion::Write(_) => unreachable!(),
|
||||
};
|
||||
let mut buf = r.buf_mut();
|
||||
file.seek(std::io::SeekFrom::Start(pos as u64))?;
|
||||
file.read(buf.as_mut_slice())
|
||||
}
|
||||
|
@ -83,7 +87,7 @@ impl IO for DarwinIO {
|
|||
std::result::Result::Ok(n) => {
|
||||
match cf {
|
||||
CompletionCallback::Read(_, ref c, _) => {
|
||||
c.complete();
|
||||
c.complete(0);
|
||||
}
|
||||
CompletionCallback::Write(_, ref c, _, _) => {
|
||||
c.complete(n);
|
||||
|
@ -142,7 +146,10 @@ impl File for DarwinFile {
|
|||
"Failed locking file. File is locked by another process"
|
||||
)));
|
||||
} else {
|
||||
return Err(LimboError::LockingError(format!("Failed locking file, {}", err)));
|
||||
return Err(LimboError::LockingError(format!(
|
||||
"Failed locking file, {}",
|
||||
err
|
||||
)));
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue