Skip to content

Commit

Permalink
build: update wasmtime to 3.0.1
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <roman@profian.com>
  • Loading branch information
rvolosatovs committed Dec 7, 2022
1 parent 0be9a41 commit 5944765
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ tempfile = "3.3.0"
tokio = { version = "1.21.2", default-features = false }
uuid = "1.1.2"
wash = { version = "0.1.0", git = "https://github.com/rvolosatovs/wash", artifact = "bin", target = "wasm32-wasi", default-features = false }
wasi-common = "2.0.0"
wasmtime = "2.0.0"
wasi-common = "3.0.1"
wasmtime = "3.0.1"
wasmtime-vfs-dir = { path = "./dir", version = "0.1.0" }
wasmtime-vfs-file = { path = "./file", version = "0.1.0" }
wasmtime-vfs-ledger = { path = "./ledger", version = "0.1.0" }
wasmtime-vfs-memory = { path = "./memory", version = "0.1.0" }
wasmtime-wasi = "2.0.0"
wasmtime-wasi = "3.0.1"
11 changes: 6 additions & 5 deletions file/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::ops::{Deref, DerefMut};
use std::sync::Arc;

use wasi_common::file::{Advice, FdFlags, FileType, Filestat};
use wasi_common::{Error, ErrorExt, ErrorKind, SystemTimeSpec, WasiDir, WasiFile};
use wasi_common::{Error, ErrorExt, SystemTimeSpec, WasiDir, WasiFile};
use wasmtime_vfs_ledger::InodeId;
use wasmtime_vfs_memory::{Data, Inode, Link, Node, Open, State};

Expand Down Expand Up @@ -295,16 +295,17 @@ impl WasiFile for OpenFile {
SeekFrom::Current(_) => i64::try_from(olock.pos),
SeekFrom::Start(_) => Ok(0),
SeekFrom::End(_) => i64::try_from(ilock.content.len()),
};
}
.map_err(|e| Error::invalid_argument().context(e))?;

let off = match pos {
SeekFrom::Current(off) => Ok(off),
SeekFrom::Start(off) => i64::try_from(off),
SeekFrom::End(off) => Ok(off),
};
}
.map_err(|e| Error::invalid_argument().context(e))?;

let pos = cur.map_err(|_| ErrorKind::Inval)? + off.map_err(|_| ErrorKind::Inval)?;
let pos = usize::try_from(pos).map_err(|_| ErrorKind::Inval)?;
let pos = usize::try_from(cur + off).map_err(|e| Error::invalid_argument().context(e))?;
olock.pos = pos;

Ok(pos as u64)
Expand Down
7 changes: 3 additions & 4 deletions tests/util/wash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use super::{Noop, Surround, Tee};

use anyhow::{bail, Context};
use wasi_common::pipe::{ReadPipe, WritePipe};
use wasi_common::{WasiDir, WasiFile};
use wasmtime::{Engine, Linker, Module, Store, Trap};
use wasi_common::{I32Exit, WasiDir, WasiFile};
use wasmtime::{Engine, Linker, Module, Store};
use wasmtime_wasi::{stdio, WasiCtxBuilder};

pub async fn wash(
Expand Down Expand Up @@ -80,8 +80,7 @@ pub async fn wash(
.typed::<(), (), _>(&store)
.context("failed to assert default function type")?
.call(&mut store, ())
.as_ref()
.map_err(Trap::i32_exit_status)
.map_err(|e| e.downcast().map(|I32Exit(code)| code))
.expect_err("`wash` did not set an exit code, did you forget to execute `exit`?")
.context("failed to execute default function")?
};
Expand Down

0 comments on commit 5944765

Please sign in to comment.