Skip to content

drush pm:security -n wrong status-code #3749

@ghost

Description

Describe the bug
drush returns a statuscode indicating that there is an error, although there is none.
This wil terminate good scripts tasked with updating a drupal-site in the moment when they need to run flawlessly.

To Reproduce
Install a Drupal-Site expecting a core-update e.g. 8.6.1.
Run drush pm:security -n ; echo $? .

Expected behavior
I expect to see a non-zero status-code only when there is an error causing drush not to perform the task requested, because of varying conditions.
Running drush pm:security -n should not return non-zero when there is an update as getting an update is expected behaviour and not an error.

Actual behavior
A script written to stop when an error occures as to not do any damage will not be able to perform an update.
e.g.

`
function handleErrors() {
$statusCode=$?;
......
exit $statusCode;
}
trap handleErrors ERR

.....
......drush pm:security -n --pipe......
..... update-action never executed.........
`

Workaround
Disable Trap with trap - ERR.
This has the drawback that you will not be able to respond to an actual error happening.

System Configuration

Linux
Drupal 8.6.1
Drush Commandline Tool 9.2.3
PHP 71

Additional information
None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions