Refactor RunCmd for use outside of ProcessInput.