{"action":"created","issue":{"url":"https://api.github.com/repos/drush-ops/drush/issues/2067","repository_url":"https://api.github.com/repos/drush-ops/drush","labels_url":"https://api.github.com/repos/drush-ops/drush/issues/2067/labels{/name}","comments_url":"https://api.github.com/repos/drush-ops/drush/issues/2067/comments","events_url":"https://api.github.com/repos/drush-ops/drush/issues/2067/events","html_url":"https://github.com/drush-ops/drush/issues/2067","id":140997745,"number":2067,"title":"Drush 8.x and 9.x loses root dir if separate drush exists in /vendor/bin under a parent dir","user":{"login":"mikecrittenden","id":32261,"avatar_url":"https://avatars.githubusercontent.com/u/32261?v=3","gravatar_id":"","url":"https://api.github.com/users/mikecrittenden","html_url":"https://github.com/mikecrittenden","followers_url":"https://api.github.com/users/mikecrittenden/followers","following_url":"https://api.github.com/users/mikecrittenden/following{/other_user}","gists_url":"https://api.github.com/users/mikecrittenden/gists{/gist_id}","starred_url":"https://api.github.com/users/mikecrittenden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikecrittenden/subscriptions","organizations_url":"https://api.github.com/users/mikecrittenden/orgs","repos_url":"https://api.github.com/users/mikecrittenden/repos","events_url":"https://api.github.com/users/mikecrittenden/events{/privacy}","received_events_url":"https://api.github.com/users/mikecrittenden/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-03-15T14:59:02Z","updated_at":"2016-03-15T17:58:54Z","closed_at":null,"body":"Here's an example directory structure:\r\n\r\n```\r\nbuild\r\n    html (DRUPAL DOCROOT GOES HERE)\r\nvendor\r\n    bin\r\n        drush (PROJECT-BUNDLED DRUSH EXISTS HERE)\r\n```\r\n\r\nLet's imagine that the host machine has Drush 8 installed globally (the version of the project-bundled drush seems to be irrelevant). \r\n\r\nIf you `cd` into `build/html` and run `drush status` (or any other Drush command) then what happens is that your global Drush (version 8) first tries to find a locally bundled Drush if one exists (see https://github.com/drush-ops/drush/blob/master/includes/startup.inc#L76). In our case, one does exist in `/vendor/bin`. \r\n\r\nOnce it finds that, it seems to decide that that is the new `root` and `chdir`'s to it (see https://github.com/drush-ops/drush/blob/master/includes/startup.inc#L281), and thus you lose the fact that you were running Drush from `/build/html` and now it can't find Drupal anymore.\r\n\r\nIs this the desired behavior? It seems to mean that whenever you're using Drush 8 or 9 in a project where `/vendor/bin/drush` exists in a parent directory, then you ALWAYS have to include the `--root` parameter for it to work, even if you're running Drush from the docroot in the first place."},"comment":{"url":"https://api.github.com/repos/drush-ops/drush/issues/comments/196949530","html_url":"https://github.com/drush-ops/drush/issues/2067#issuecomment-196949530","issue_url":"https://api.github.com/repos/drush-ops/drush/issues/2067","id":196949530,"user":{"login":"weitzman","id":7740,"avatar_url":"https://avatars.githubusercontent.com/u/7740?v=3","gravatar_id":"","url":"https://api.github.com/users/weitzman","html_url":"https://github.com/weitzman","followers_url":"https://api.github.com/users/weitzman/followers","following_url":"https://api.github.com/users/weitzman/following{/other_user}","gists_url":"https://api.github.com/users/weitzman/gists{/gist_id}","starred_url":"https://api.github.com/users/weitzman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weitzman/subscriptions","organizations_url":"https://api.github.com/users/weitzman/orgs","repos_url":"https://api.github.com/users/weitzman/repos","events_url":"https://api.github.com/users/weitzman/events{/privacy}","received_events_url":"https://api.github.com/users/weitzman/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T17:58:54Z","updated_at":"2016-03-15T17:58:54Z","body":"Can you share a composer.json which installs drupal into build/html, depends on drush, etc?"}}