Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drush fails to report error for bad alias within group #2847

Open
AdamPS opened this issue Jul 19, 2017 · 2 comments
Open

Drush fails to report error for bad alias within group #2847

AdamPS opened this issue Jul 19, 2017 · 2 comments
Labels

Comments

@AdamPS
Copy link
Contributor

AdamPS commented Jul 19, 2017

I recently discovered that my nightly backup had been silently failing for nearly a week. The backup runs from cron calling a custom drush command like this:
cronwrap drush -y @allbackup my-backup-command

I had mistakenly mistyped an alias in the group @allbackup. Drush printed a warning message and exited without running the command on any server yet with code 0. cronwrap deduced the command had succeeded so I didn't get any alert.

To reproduce the bug, set up aliases.drushrc.php as follows:
$aliases['myalias'] = ['site-list' => ['@badalias']];

Then run the sequence of shell commands below

$ drush @myalias status
You are about to execute 'status' non-interactively (--yes forced) on all of the following targets:
  @badalias
Continue?  (y/n): y
Not found: @badalias                         [warning]
$ echo $?
0

In contrast, drush correctly reports an error when running directly with a bad alias.

$ drush @badalias status
Could not find the alias @badalias                 [error]
$ echo $?
1

@greg-1-anderson
Copy link
Member

It would indeed be preferable if Drush aborted with an error if any alias in a group did not exist.

@AdamPS
Copy link
Contributor Author

AdamPS commented Jul 26, 2017

@greg-1-anderson Thanks for the reply. I have raised PR #2854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants