Skip to content

Commit

Permalink
Follow up to containerd#219 and containerd#156
Browse files Browse the repository at this point in the history
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant committed Aug 15, 2023
1 parent 5fba436 commit cde2bb0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
15 changes: 6 additions & 9 deletions crates/containerd-shim-wasmedge/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,12 @@ impl Executor for WasmEdgeExecutor {

fn can_handle(&self, spec: &Spec) -> bool {
// check if the entrypoint of the spec is a wasm binary.
let args = oci::get_args(spec);
if args.is_empty() {
return false;
}

let start = args[0].clone();
let mut iterator = start.split('#');
let cmd = iterator.next().unwrap().to_string();
let path = PathBuf::from(cmd);
let (module_name, _method) = oci::get_module(spec);
let module_name = match module_name {
Some(m) => m,
None => return false,
};
let path = PathBuf::from(module_name);

path.extension()
.map(|ext| ext.to_ascii_lowercase())
Expand Down
15 changes: 6 additions & 9 deletions crates/containerd-shim-wasmtime/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,12 @@ impl Executor for WasmtimeExecutor {

fn can_handle(&self, spec: &Spec) -> bool {
// check if the entrypoint of the spec is a wasm binary.
let args = oci::get_args(spec);
if args.is_empty() {
return false;
}

let start = args[0].clone();
let mut iterator = start.split('#');
let cmd = iterator.next().unwrap().to_string();
let path = PathBuf::from(cmd);
let (module_name, _method) = oci::get_module(spec);
let module_name = match module_name {
Some(m) => m,
None => return false,
};
let path = PathBuf::from(module_name);

// TODO: do we need to validate the wasm binary?
// ```rust
Expand Down

0 comments on commit cde2bb0

Please sign in to comment.