Some build scripts will try to immediately execute freshly-built binaries, bypassing this can be nasty and sometimes it's easier to have the emscripten-produced binaries have the node-invoking hashbang and have executable bit via chmod +x. At least surfacing this as a compiler option would be useful (and also may be useful to ask emscripten to produce both the node-invokable JS and sidecar *.wasm file).
Some build scripts will try to immediately execute freshly-built binaries, bypassing this can be nasty and sometimes it's easier to have the emscripten-produced binaries have the
node
-invoking hashbang and have executable bit viachmod +x
. At least surfacing this as a compiler option would be useful (and also may be useful to ask emscripten to produce both the node-invokable JS and sidecar*.wasm
file).It also appears that now hashbang is also accepted in JavaScript as comment: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#hashbang_comments, so in theory might be okay to always produce this hashbang and at least it should not prevent these hashbang-prefixed files to be consummable by conventional JavaScript engines
Originally discussed in: