drush_remote_command() takes care of running a command across multiple sites when it detects @sites (or --site-list). The function returns false if the user reject to perform the command. It should return true for drush's main loop to prevent trying bootstrap to a site.

jonhattan@jengibre:/var/www/drupal-6.x$ drush @sites up
You are about to execute 'up' non-interactively (--yes forced) on all of the following targets:
  #d620
  #d7sudb
  #d6
  #d620.com
  #adepsi
Continue?  (y/n): n
Aborting.                                                                                                          [cancel]
You are about to execute 'up' non-interactively (--yes forced) on all of the following targets:
  #d620
  #d7sudb
  #d6
  #d620.com
  #adepsi
Continue?  (y/n): n
Aborting.                                                                                                          [cancel]
Command pm-update needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal [error]
environment to run this command.
Command pm-update needs the following modules installed/enabled to run: update.                                    [error]
The drush command 'up' could not be executed.                                                                      [error]
Could not find a Drupal settings.php file at ./sites/default/settings.php.                                         [error]

I think proposed solution doesn't break anything.

CommentFileSizeAuthor
drush-site-list-abort.patch688 bytesjonhattan

Comments

greg.1.anderson’s picture

Status: Needs review » Closed (duplicate)

Sorry, I missed this issue! Duplicate of #1156082: drush multisite commands execute even if aborted..

greg.1.anderson’s picture

Status: Closed (duplicate) » Reviewed & tested by the community

Upon reflection, I decided that I preferred jonhattan's fix to mine. If there are no other comments, this can be committed.

moshe weitzman’s picture

No objection from me

jonhattan’s picture

Status: Reviewed & tested by the community » Fixed

committed.

jonhattan’s picture

Version: » All-versions-4.x-dev
Assigned: Unassigned » msonnabaum
Status: Fixed » Patch (to be ported)
msonnabaum’s picture

Status: Patch (to be ported) » Fixed

Backported.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.