You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove DRUSH_EXECUTION_COMPLETED and DRUSH_EXIT_CODE handling (#3780)
* Drush no longer cares about DRUSH_EXECUTION_COMPLETED and DRUSH_EXIT_CODE
* Update test.
* Bring back handling of exit() during termination
* Remove drush_return_status().
* Bring back drush_return_status(). It changes exit code based on drush_get_error()
Also mark a few context methods as deprecated
* Use new CommandResult class
* Use newly released Annotated Command.
Copy file name to clipboardExpand all lines: includes/environment.inc
-13Lines changed: 0 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -55,19 +55,6 @@ function drush_error_handler($errno, $message, $filename, $line) {
55
55
}
56
56
}
57
57
58
-
/**
59
-
* Evalute the environment after an abnormal termination and
60
-
* see if we can determine any configuration settings that the user might
61
-
* want to adjust.
62
-
*/
63
-
function_drush_postmortem() {
64
-
// Make sure that the memory limit has been bumped up from the minimum default value of 32M.
65
-
$php_memory_limit = drush_memory_limit();
66
-
if (($php_memory_limit > 0) && ($php_memory_limit <= 32*DRUSH_KILOBYTE*DRUSH_KILOBYTE)) {
67
-
drush_set_error('DRUSH_MEMORY_LIMIT', dt('Your memory limit is set to !memory_limit; Drush needs as much memory to run as Drupal. !php_ini_msg', ['!memory_limit' => $php_memory_limit / (DRUSH_KILOBYTE*DRUSH_KILOBYTE) . 'M', '!php_ini_msg' => _drush_php_ini_loaded_file_message()]));
68
-
}
69
-
}
70
-
71
58
/**
72
59
* Converts a Windows path (dir1\dir2\dir3) into a Unix path (dir1/dir2/dir3).
73
60
* Also converts a cygwin "drive emulation" path (/cygdrive/c/dir1) into a
* Shutdown function for use while Drush and Drupal are bootstrapping and to return any
31
-
* registered errors.
32
-
*
33
-
* The shutdown command checks whether certain options are set to reliably
34
-
* detect and log some common Drupal initialization errors.
35
-
*
36
22
* If the command is being executed with the --backend option, the script
37
23
* will return a json string containing the options and log information
38
24
* used by the script.
@@ -46,21 +32,8 @@ function drush_shutdown() {
46
32
return;
47
33
}
48
34
49
-
// Mysteriously make $user available during sess_write(). Avoids a NOTICE.
50
-
global$user;
51
-
52
-
if (!drush_get_context('DRUSH_EXECUTION_COMPLETED', FALSE) && !drush_get_context('DRUSH_USER_ABORT', FALSE)) {
53
-
$php_error_message = '';
54
-
if ($error = error_get_last()) {
55
-
$php_error_message = "\n" . dt('Error: !message in !file, line !line', ['!message' => $error['message'], '!file' => $error['file'], '!line' => $error['line']]);
56
-
}
57
-
// We did not reach the end of the drush_main function,
58
-
// this generally means somewhere in the code a call to exit(),
59
-
// was made. We catch this, so that we can trigger an error in
60
-
// those cases.
61
-
drush_set_error("DRUSH_NOT_COMPLETED", dt("Drush command terminated abnormally due to an unrecoverable error.!message", ['!message' => $php_error_message]));
62
-
// Attempt to give the user some advice about how to fix the problem
63
-
_drush_postmortem();
35
+
if (!Drush::config()->get(Runtime::DRUSH_RUNTIME_COMPLETED_NAMESPACE)) {
36
+
thrownewRuntimeException('Drush command terminated abnormally. Check for an exit() in your Drupal site.');
64
37
}
65
38
66
39
if (Drush::backend()) {
@@ -108,6 +81,9 @@ function drush_coverage_shutdown() {
108
81
}
109
82
}
110
83
84
+
/**
85
+
* @deprecated. This function will be removed in Drush 10. Throw an exception to indicate an error.
0 commit comments