#1016890 reapply contributed patch for fixing infinite loop - the reason it broke under Drush 4 was that I blew away our incorporation of the new cli context