Open jimpo opened 2 years ago
process.exit called only when we have very abnormal situation and can't recover compiler. If you want to do something before exit you could add hook like process.on('exit', () => { ...some custom cleanups or/and save.... });
It seems very reasonable to be able to try-catch
errors, especially if the error handling is part of a bigger applications (for example, imagine a repl or IDE that passes code through compiler: instead of exiting, it needs to display issues.
The docs say that the compiler can be called programatically using the
cli/asc.js
API. But there are situations where it may crash and instead of throwing an Error which could be caught, this module callsprocess.exit
. This limits the contexts that could embed directs calls to this API. I think either there should be an API option not to call exit on crash, or the docs should state that the API should only be called in a subprocess.