[core] Allow a module to return a non-zero exit code. See issue #180