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.

1 call to drush_get_username()
drush_directory_cache in includes/
The path to the global cache directory.


includes/, line 789
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;