The problem is that $exit_code is not set when running an action other than "status".