bytenode/bytenode

Unable to get correct exit code from process.exit(code) when using bytenode to compile

JiaxuanYang opened this issue · 3 comments

I need to get the exit code to determine next step, but the exit code is always 0 no matter what it actually returns.

echo $? returns 1 when I use node, and returns 0 when I use bytenode

if that's because process.exit only works for node, then how can I exit a file with status code like process.exit(code) for bytenode?

This is because, in the case of bytenode, you get the exit code of bytenode process itself. The use of spawnSync in bytenode CLI needs to be corrected to capture the exit code (and to be honest, I don't remember off the top of my head if this is possible or not).

For a quick workaround, you can use this command node -r bytenode index.jsc instead of bytenode index.jsc (with bytenode installed locally). So basically you use bytenode CLI to compile your files, and use node itself to run your .jsc files while telling it to require bytenode first.

Let me know if this workaround solves your issue. I'm a bit busy so I won't work on this fix unless necessary.

thank you! the node -r bytenode index.jsc works!