Move runCommand() to core utils.