Handle exit code for run method