function drush_find_drush

8.0.x drush_find_drush()
6.x drush_find_drush()
7.x drush_find_drush()
3.x drush_find_drush()
4.x drush_find_drush()
5.x drush_find_drush()
master drush_find_drush()

Determine a proper way to call drush again

This check if we were called directly or as an argument to some wrapper command (php and sudo are checked now).

Calling ./drush.php directly yields the following environment:

_SERVER["argv"][0] => ./drush.php

Calling php ./drush.php also yields the following:

_SERVER["argv"][0] => ./drush.php

Note that the $_ global is defined only in bash and therefore cannot be relied upon.

The DRUSH_COMMAND constant is initialised to the value of this function when is loaded.

See also


3 calls to drush_find_drush()
drush_preflight in includes/
During the initialization of Drush, this is the first step where we load our configuration and commandfiles, and select the site we are going to operate on; however, we take no irreversible actions (e.g. site bootstrapping). This allows commands that…
drush_preflight_command_dispatch in includes/
Handle any command preprocessing that may need to be done, including potentially redispatching the command immediately (e.g. for remote commands).
_drush_sitealias_add_transient_defaults in includes/
Add "transient" default values to the given alias record. The difference between a static default and a transient default is that static defaults -always- exist in the alias record, whereas transient defaults are only added if the given…


includes/, line 406
Functions used by drush to query the environment and setting the current configuration.


function drush_find_drush() {
  $drush = realpath($_SERVER['argv']['0']);
  // TODO: On Windows, if we leave $drush as-is, then callbacks will
  // be done just as we were called by the batch file:  php.exe C:\path\drush.php
  // We could also convert drush.php to drush.bat to run the batch file again,
  // but this works just as well.
  return $drush;