Skip to content

Commit a454079

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

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

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

+6-9
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,12 @@ 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 => return false,
62+
};
63+
let path = PathBuf::from(module_name);
6764

6865
path.extension()
6966
.map(|ext| ext.to_ascii_lowercase())

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

+6-9
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,12 @@ 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 => return false,
64+
};
65+
let path = PathBuf::from(module_name);
6966

7067
// TODO: do we need to validate the wasm binary?
7168
// ```rust

0 commit comments

Comments
 (0)