Skip to content

Commit 23ef04a

Browse files
committed
test-components: Write adapted components to unique path
Rather than overwriting the module with the adapted component, write it to a new file to prevent bad state on partial build failure. Signed-off-by: Lann Martin <[email protected]>
1 parent 0108585 commit 23ef04a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test-components/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn main() {
4848
let const_name = to_shouty_snake_case(&package);
4949
let package_name = manifest.package.expect("manifest has no package").name;
5050
let binary_name = package_name.replace(['-', '.'], "_");
51-
let wasm_path = out_dir
51+
let mut wasm_path = out_dir
5252
.join("wasm32-wasi")
5353
.join("debug")
5454
.join(format!("{binary_name}.wasm"));
@@ -71,6 +71,7 @@ fn main() {
7171
.expect("failed to apply adapter")
7272
.encode()
7373
.expect("failed to encode component");
74+
wasm_path = wasm_path.with_extension("adapted.wasm");
7475
std::fs::write(&wasm_path, new_bytes).expect("failed to write new wasm binary");
7576
}
7677

0 commit comments

Comments
 (0)