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

1 call to drush_find_drush()
_drush_bootstrap_drush in includes/bootstrap.inc
Initial Drush bootstrap phase.

File

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

Code

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;
}