wasm4 icon indicating copy to clipboard operation
wasm4 copied to clipboard

`wasm watch` fails to run carts unless they are named cart.wasm

Open jonathanderque opened this issue 3 years ago • 2 comments

Description

If you happen to rename your cart from cart.wasm to my_zig_game.wasm, then w4 watch zig-out/lib/my_zig_game.wasm will fail with a ENOENT error:

events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, open 'zig-out/lib/cart.wasm'
Emitted 'error' event on ReadStream instance at:
    at internal/fs/streams.js:136:12
    at FSReqCallback.oncomplete (fs.js:156:23) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'zig-out/lib/cart.wasm'
}

That is: w4 watch seems to ignore the cart filename supplied as a command line argument. w4 run zig-out/lib/my_zig_game.wasm is working fine though.

System info

  • Os: Arch Linux
  • Wasm-4 2.53, but I'm pretty sure I experienced it with an earlier 2.5 version during the jam
  • Zig 0.9.1 - I don't think this is relevant. I don't know if this issue is specific to zig projects or if this happens with other languages

How to replicate

#!/bin/sh

cd /tmp
rm -rf my_zig_game
w4 new --zig my_zig_game
(
  cd my_zig_game;
  sed -i -e 's/addSharedLibrary("cart"/addSharedLibrary("my_zig_game"/' build.zig
  zig build && \
  test -f zig-out/lib/my_zig_game.wasm && echo "zig-out/lib/my_zig_game.wasm does exist" && \
  w4 watch zig-out/lib/my_zig_game.wasm
)

jonathanderque avatar Aug 23 '22 04:08 jonathanderque

i wish i could help with a patch, but i can't get npm and it's dependencies working at the moment :-(

jonathanderque avatar Aug 23 '22 05:08 jonathanderque

Hit this as well with [email protected]

rajsite avatar Dec 22 '22 00:12 rajsite