exit_code guarantees that the return value of a scan is 0 when exit_zero is enabled
(ctx: click.Context, exit_code: int, **kwargs: Any)
| 44 | @scan_group.result_callback() |
| 45 | @click.pass_context |
| 46 | def exit_code(ctx: click.Context, exit_code: int, **kwargs: Any) -> int: |
| 47 | """ |
| 48 | exit_code guarantees that the return value of a scan is 0 |
| 49 | when exit_zero is enabled |
| 50 | """ |
| 51 | ctx_obj = ContextObj.get(ctx) |
| 52 | if ( |
| 53 | exit_code == ExitCode.SCAN_FOUND_PROBLEMS |
| 54 | and ctx_obj.config.user_config.exit_zero |
| 55 | ): |
| 56 | logger.debug("scan exit_code forced to 0") |
| 57 | sys.exit(ExitCode.SUCCESS) |
| 58 | |
| 59 | logger.debug("scan exit_code=%d", exit_code) |
| 60 | return exit_code |
| 61 | |
| 62 | |
| 63 | # Plugin registry, lazily initialized when _load_plugins() is called. |