function drush_get_username

8.0.x drush_get_username()
6.x drush_get_username()
7.x drush_get_username()
5.x drush_get_username()
master drush_get_username()

Return the name of the user running drush.

3 calls to drush_get_username()
drush_directory_cache in includes/
The path to the global cache directory.
drush_sitealias_get_envar_filename in includes/
Returns the filename for the file that stores the DRUPAL_SITE variable.
siteSetUnitTest::testSiteSet in tests/siteSetUnitTest.php


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


function drush_get_username() {
  $name = NULL;
  if (!$name = getenv("username")) { // Windows
    if (!$name = getenv("USER")) {
      // If USER not defined, use posix
      if (function_exists('posix_getpwuid')) {
        $processUser = posix_getpwuid(posix_geteuid());
        $name = $processUser['name'];
  return $name;