MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
712 stars 549 forks source link

handle async log + process.exit #81

Closed shanejonas closed 2 years ago

shanejonas commented 3 years ago

was reading the node.js process docs and theres an example that says not to log to stdout + process.exit right after

https://github.com/MetaMask/snaps-cli/blob/f7976cd6e23e61007bcc8065ff2f0f1fa98e0093/src/cmds/init/initUtils.ts#L42-L47

docs link: https://nodejs.org/api/process.html#process_process_exit_code

it recommends using

process.exitCode = 1;
rekmarks commented 3 years ago

For context, we call process.exit(1) ~17 times (I deliberately chose to do the bad thing out of laziness 👍 ), although at first glance, converting the different cases to using process.exitCode and return shouldn't be that hard.