function drush_find_drush

8.0.x environment.inc drush_find_drush()
6.x environment.inc drush_find_drush()
7.x environment.inc drush_find_drush()
3.x environment.inc drush_find_drush()
4.x environment.inc drush_find_drush()
5.x environment.inc drush_find_drush()
master environment.inc 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 environment.inc is loaded.

See also

DRUSH_COMMAND

3 calls to drush_find_drush()
drush_preflight in includes/preflight.inc
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/preflight.inc
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/sitealias.inc
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…

File

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

Code

function drush_find_drush() {
  if ($drush = realpath($_SERVER['argv']['0'])) {
    return Path::canonicalize($drush);
  }
  return FALSE;
}