Run commands and handle their output