{"action":"created","issue":{"url":"https://api.github.com/repos/drush-ops/drush/issues/1066","labels_url":"https://api.github.com/repos/drush-ops/drush/issues/1066/labels{/name}","comments_url":"https://api.github.com/repos/drush-ops/drush/issues/1066/comments","events_url":"https://api.github.com/repos/drush-ops/drush/issues/1066/events","html_url":"https://github.com/drush-ops/drush/pull/1066","id":52597726,"number":1066,"title":"Make drush use @alias work even if called from a script","user":{"login":"jurgenhaas","id":1475675,"avatar_url":"https://avatars.githubusercontent.com/u/1475675?v=3","gravatar_id":"","url":"https://api.github.com/users/jurgenhaas","html_url":"https://github.com/jurgenhaas","followers_url":"https://api.github.com/users/jurgenhaas/followers","following_url":"https://api.github.com/users/jurgenhaas/following{/other_user}","gists_url":"https://api.github.com/users/jurgenhaas/gists{/gist_id}","starred_url":"https://api.github.com/users/jurgenhaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jurgenhaas/subscriptions","organizations_url":"https://api.github.com/users/jurgenhaas/orgs","repos_url":"https://api.github.com/users/jurgenhaas/repos","events_url":"https://api.github.com/users/jurgenhaas/events{/privacy}","received_events_url":"https://api.github.com/users/jurgenhaas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2014-12-21T15:14:38Z","updated_at":"2015-02-18T07:41:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/drush-ops/drush/pulls/1066","html_url":"https://github.com/drush-ops/drush/pull/1066","diff_url":"https://github.com/drush-ops/drush/pull/1066.diff","patch_url":"https://github.com/drush-ops/drush/pull/1066.patch"},"body":"If ```drush use @alias``` is called from a script, then posix_getppid() will return a process id which is not the same as the process of the hosting shell and hence the stored alias won't be recognized by subsequent calls to drush which makes drush use @alias pretty useless. This only applies if drush is called through another script, which will be the case in a lot of scenarios.\r\n\r\nTo resolve this we should grab the session id of the current process which will go up the tree to the shell which is hosting any tree of scripts that are eventually calling drush."},"comment":{"url":"https://api.github.com/repos/drush-ops/drush/issues/comments/74824600","html_url":"https://github.com/drush-ops/drush/pull/1066#issuecomment-74824600","issue_url":"https://api.github.com/repos/drush-ops/drush/issues/1066","id":74824600,"user":{"login":"jurgenhaas","id":1475675,"avatar_url":"https://avatars.githubusercontent.com/u/1475675?v=3","gravatar_id":"","url":"https://api.github.com/users/jurgenhaas","html_url":"https://github.com/jurgenhaas","followers_url":"https://api.github.com/users/jurgenhaas/followers","following_url":"https://api.github.com/users/jurgenhaas/following{/other_user}","gists_url":"https://api.github.com/users/jurgenhaas/gists{/gist_id}","starred_url":"https://api.github.com/users/jurgenhaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jurgenhaas/subscriptions","organizations_url":"https://api.github.com/users/jurgenhaas/orgs","repos_url":"https://api.github.com/users/jurgenhaas/repos","events_url":"https://api.github.com/users/jurgenhaas/events{/privacy}","received_events_url":"https://api.github.com/users/jurgenhaas/received_events","type":"User","site_admin":false},"created_at":"2015-02-18T07:41:17Z","updated_at":"2015-02-18T07:41:17Z","body":"Copying ppid file would have to work 2-ways: when ```drush use @alias``` is used, the ppid file needs to be copied over to the sid file and for each subsequent ```drush``` call that is *not* ```drush use``` it needs to copy back from the sid to the new ppid file of the new sudo process. And all that needs to happen within that one sudo process that also calls drush because only inside there is a way to know its ppid, or am I missing anything?\r\n\r\nThis sounds really really hard and I'd prefer the cli option."}}