Skip to content

Commit 98f2418

Browse files
committed
Follow up to containerd#219 and containerd#156
Signed-off-by: James Sturtevant <[email protected]>
1 parent 5fba436 commit 98f2418

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

Diff for: crates/containerd-shim-wasmedge/src/executor.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@ impl Executor for WasmEdgeExecutor {
5555

5656
fn can_handle(&self, spec: &Spec) -> bool {
5757
// check if the entrypoint of the spec is a wasm binary.
58-
let args = oci::get_args(spec);
59-
if args.is_empty() {
60-
return false;
61-
}
62-
63-
let start = args[0].clone();
64-
let mut iterator = start.split('#');
65-
let cmd = iterator.next().unwrap().to_string();
66-
let path = PathBuf::from(cmd);
58+
let (module_name, _method) = oci::get_module(spec);
59+
let module_name = match module_name {
60+
Some(m) => m,
61+
None => {
62+
return false
63+
}
64+
};
65+
let path = PathBuf::from(module_name);
6766

6867
path.extension()
6968
.map(|ext| ext.to_ascii_lowercase())

Diff for: crates/containerd-shim-wasmtime/src/executor.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,14 @@ impl Executor for WasmtimeExecutor {
5757

5858
fn can_handle(&self, spec: &Spec) -> bool {
5959
// check if the entrypoint of the spec is a wasm binary.
60-
let args = oci::get_args(spec);
61-
if args.is_empty() {
62-
return false;
63-
}
64-
65-
let start = args[0].clone();
66-
let mut iterator = start.split('#');
67-
let cmd = iterator.next().unwrap().to_string();
68-
let path = PathBuf::from(cmd);
60+
let (module_name, _method) = oci::get_module(spec);
61+
let module_name = match module_name {
62+
Some(m) => m,
63+
None => {
64+
return false
65+
}
66+
};
67+
let path = PathBuf::from(module_name);
6968

7069
// TODO: do we need to validate the wasm binary?
7170
// ```rust

0 commit comments

Comments
 (0)