bun icon indicating copy to clipboard operation
bun copied to clipboard

refactor(Global): mark more error code as cold and introduce new internal exit API

Open wooster0 opened this issue 1 year ago • 0 comments

It's slightly different from what I described in the PR description of https://github.com/oven-sh/bun/pull/535. Now Global.exit() means successful exit, Global.crash() retains its meaning of unsuccessful exit, and Global.exitOther(n) is used for any other specific exit code, with the latter two having @setCold(true) set for hints to the compiler.

While looking over the diff I notice that a lot of times the success-indicating Global.exit() is used after an error was printed. It seems like it's not well defined when exactly Global.crash() should be used and when Global.exit(). It'd probably be better if there was an error printing function that prints both a message and also exits with 1.

wooster0 avatar Jul 10 '22 15:07 wooster0