s/hooks_dir/hook_dirs/ and set exit code before post hooks