As coded your function makes you script exit before it returns. Just removeThis is because $(crash) executes crash in a subshell, so the exit fromapplies to the function bodysubshell and not to your script.
What is the point of capturing the output in a variable if you won't use it because the script exited anyway?