exit function

Never exit(
  1. int code
)

Exit the process immediately with the given exit code.

This does not wait for any asynchronous operations to terminate. Using exit is therefore very likely to lose data.

The handling of exit codes is platform specific.

On Linux and OS X an exit code for normal termination will always be in the range 0..255. If an exit code outside this range is set the actual exit code will be the lower 8 bits masked off and treated as an unsigned value. E.g. using an exit code of -1 will result in an actual exit code of 255 being reported.

On Windows the exit code can be set to any 32-bit value. However some of these values are reserved for reporting system errors like crashes.

Implementation

Never exit(int code) {
  process.exit(code);
  throw StateError('Expected process to exit');
}