{"action":"created","issue":{"url":"https://api.github.com/repos/geany/geany/issues/436","labels_url":"https://api.github.com/repos/geany/geany/issues/436/labels{/name}","comments_url":"https://api.github.com/repos/geany/geany/issues/436/comments","events_url":"https://api.github.com/repos/geany/geany/issues/436/events","html_url":"https://github.com/geany/geany/pull/436","id":60033122,"number":436,"title":"Use lsof to get cwd of shell when /proc/pid/cwd isn't available","user":{"login":"techee","id":713965,"avatar_url":"https://avatars.githubusercontent.com/u/713965?v=3","gravatar_id":"","url":"https://api.github.com/users/techee","html_url":"https://github.com/techee","followers_url":"https://api.github.com/users/techee/followers","following_url":"https://api.github.com/users/techee/following{/other_user}","gists_url":"https://api.github.com/users/techee/gists{/gist_id}","starred_url":"https://api.github.com/users/techee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/techee/subscriptions","organizations_url":"https://api.github.com/users/techee/orgs","repos_url":"https://api.github.com/users/techee/repos","events_url":"https://api.github.com/users/techee/events{/privacy}","received_events_url":"https://api.github.com/users/techee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-03-05T23:19:09Z","updated_at":"2015-03-06T23:25:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/geany/geany/pulls/436","html_url":"https://github.com/geany/geany/pull/436","diff_url":"https://github.com/geany/geany/pull/436.diff","patch_url":"https://github.com/geany/geany/pull/436.patch"},"body":"lsof can be used to get cwd of a process and it's available\r\non basically every UNIX. In addition, it offers the \"output for\r\nother programs\" mode which is kind of standardized and\r\nshouldn't change in the future. I have tested the lsof command\r\non linux, PC BSD and OS X and both the parameters and\r\noutput are identical everywhere. In addition, the patch\r\nperforms some checks if the output corresponds to what we\r\nexpect."},"comment":{"url":"https://api.github.com/repos/geany/geany/issues/comments/77654955","html_url":"https://github.com/geany/geany/pull/436#issuecomment-77654955","issue_url":"https://api.github.com/repos/geany/geany/issues/436","id":77654955,"user":{"login":"b4n","id":793526,"avatar_url":"https://avatars.githubusercontent.com/u/793526?v=3","gravatar_id":"","url":"https://api.github.com/users/b4n","html_url":"https://github.com/b4n","followers_url":"https://api.github.com/users/b4n/followers","following_url":"https://api.github.com/users/b4n/following{/other_user}","gists_url":"https://api.github.com/users/b4n/gists{/gist_id}","starred_url":"https://api.github.com/users/b4n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b4n/subscriptions","organizations_url":"https://api.github.com/users/b4n/orgs","repos_url":"https://api.github.com/users/b4n/repos","events_url":"https://api.github.com/users/b4n/events{/privacy}","received_events_url":"https://api.github.com/users/b4n/received_events","type":"User","site_admin":false},"created_at":"2015-03-06T23:25:01Z","updated_at":"2015-03-06T23:25:01Z","body":"> The lsof code\r\n> \r\n>https://opensource.apple.com/source/lsof/lsof-53/lsof/proc.c\r\n>\r\n>on darwin looks quite platform-specific, full of ifdefs and I'm absolutely not sure if it will work on other BSD systems so using lsof itself as an interface seems to be a cleaner option (though it might not be installed everywhere).\r\n\r\nI tried to understand it, and it's actually in `dproc` (either [reading kmem](https://opensource.apple.com/source/lsof/lsof-53/lsof/dialects/darwin/kmem/dproc.c) or [using libproc (or something)](https://opensource.apple.com/source/lsof/lsof-53/lsof/dialects/darwin/libproc/dproc.c)).  But indeed, it looks a quite tricky and not something we wanna duplicate."}}