IMO, this function should accept a command to run. Setting global variables from a function is pretty weird.