Expose exit code from exec_command

I tried to write a test for this but had trouble getting it to work because this change causes exec_command to block till the server sends an exit code.