{"action":"created","comment":{"url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments/43855614","id":43855614,"diff_hunk":"@@ -10,28 +10,28 @@ export class LogcatHelper implements Mobile.ILogcatHelper {\n \t\t\tprivate $logger: ILogger,\n \t\t\tprivate $staticConfig: Config.IStaticConfig) { }\n \n-\tpublic start(deviceIdentifier: string): any {\n-\t\tlet adbPath = this.$staticConfig.getAdbFilePath().wait();\n-\t\tthis.$childProcess.exec(util.format(\"%s -s %s logcat -c\", adbPath, deviceIdentifier)).wait(); // remove cached logs\n-\t\tlet adbLogcat = this.$childProcess.spawn(adbPath, [\"-s\", deviceIdentifier, \"logcat\"]);\n-\t\tlet lineStream = byline(adbLogcat.stdout);\n+\tpublic start(deviceIdentifier: string): void {\n+\t\tif(deviceIdentifier) {\n+\t\t\tlet adbPath = this.$staticConfig.getAdbFilePath().wait();\n+\t\t\tthis.$childProcess.exec(util.format(\"%s -s %s logcat -c\", adbPath, deviceIdentifier)).wait(); // remove cached logs","path":"mobile/android/logcat-helper.ts","position":12,"original_position":12,"commit_id":"d6ea9c3334ca81f9209e44895e4891925d871657","original_commit_id":"d6ea9c3334ca81f9209e44895e4891925d871657","user":{"login":"teobugslayer","id":5443453,"avatar_url":"https://avatars.githubusercontent.com/u/5443453?v=3","gravatar_id":"","url":"https://api.github.com/users/teobugslayer","html_url":"https://github.com/teobugslayer","followers_url":"https://api.github.com/users/teobugslayer/followers","following_url":"https://api.github.com/users/teobugslayer/following{/other_user}","gists_url":"https://api.github.com/users/teobugslayer/gists{/gist_id}","starred_url":"https://api.github.com/users/teobugslayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teobugslayer/subscriptions","organizations_url":"https://api.github.com/users/teobugslayer/orgs","repos_url":"https://api.github.com/users/teobugslayer/repos","events_url":"https://api.github.com/users/teobugslayer/events{/privacy}","received_events_url":"https://api.github.com/users/teobugslayer/received_events","type":"User","site_admin":false},"body":"consider spawning instead of execing","created_at":"2015-11-04T08:59:24Z","updated_at":"2015-11-04T08:59:24Z","html_url":"https://github.com/telerik/mobile-cli-lib/pull/507#discussion_r43855614","pull_request_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507","_links":{"self":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments/43855614"},"html":{"href":"https://github.com/telerik/mobile-cli-lib/pull/507#discussion_r43855614"},"pull_request":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507"}}},"pull_request":{"url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507","id":49617346,"html_url":"https://github.com/telerik/mobile-cli-lib/pull/507","diff_url":"https://github.com/telerik/mobile-cli-lib/pull/507.diff","patch_url":"https://github.com/telerik/mobile-cli-lib/pull/507.patch","issue_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/507","number":507,"state":"open","locked":false,"title":"Fix leaking of adb processes","user":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"body":"When we print device logs, we execute `adb -s <device identifier> logcat`.\r\nIn case the device is not unlocked, we receive `undefined` for deviceIdentifier and the command leaks adb processes.\r\nIt looks like executing `adb -s <invalid id> logcat` is not closed even after our process exits.\r\nFix this by checking the passed value. Also change the return type of `LogcatHelper`'s `start` method to void\r\nas noone is using the returned child_process.","created_at":"2015-11-03T21:50:33Z","updated_at":"2015-11-04T08:59:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"06c282cc77d83962f53fc2717a05f4941fed8dcd","assignee":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507/commits","review_comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507/comments","review_comment_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/507/comments","statuses_url":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/d6ea9c3334ca81f9209e44895e4891925d871657","head":{"label":"telerik:vladimirov/fix-adb-leak","ref":"vladimirov/fix-adb-leak","sha":"d6ea9c3334ca81f9209e44895e4891925d871657","user":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"repo":{"id":21348075,"name":"mobile-cli-lib","full_name":"telerik/mobile-cli-lib","owner":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telerik/mobile-cli-lib","description":"Contains common infrastructure for CLIs - mainly AppBuilder, NativeScript and DDB.","fork":false,"url":"https://api.github.com/repos/telerik/mobile-cli-lib","forks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/forks","keys_url":"https://api.github.com/repos/telerik/mobile-cli-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telerik/mobile-cli-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telerik/mobile-cli-lib/teams","hooks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/hooks","issue_events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/events{/number}","events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/events","assignees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/assignees{/user}","branches_url":"https://api.github.com/repos/telerik/mobile-cli-lib/branches{/branch}","tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/tags","blobs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/telerik/mobile-cli-lib/languages","stargazers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/stargazers","contributors_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contributors","subscribers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscribers","subscription_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscription","commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contents/{+path}","compare_url":"https://api.github.com/repos/telerik/mobile-cli-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telerik/mobile-cli-lib/merges","archive_url":"https://api.github.com/repos/telerik/mobile-cli-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telerik/mobile-cli-lib/downloads","issues_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues{/number}","pulls_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/telerik/mobile-cli-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/telerik/mobile-cli-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telerik/mobile-cli-lib/labels{/name}","releases_url":"https://api.github.com/repos/telerik/mobile-cli-lib/releases{/id}","created_at":"2014-06-30T10:54:52Z","updated_at":"2015-08-21T03:33:58Z","pushed_at":"2015-11-03T21:56:02Z","git_url":"git://github.com/telerik/mobile-cli-lib.git","ssh_url":"git@github.com:telerik/mobile-cli-lib.git","clone_url":"https://github.com/telerik/mobile-cli-lib.git","svn_url":"https://github.com/telerik/mobile-cli-lib","homepage":"","size":13653,"stargazers_count":7,"watchers_count":7,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":7,"default_branch":"master"}},"base":{"label":"telerik:master","ref":"master","sha":"0800da03afc56c93f7c25861f708c4417edbc380","user":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"repo":{"id":21348075,"name":"mobile-cli-lib","full_name":"telerik/mobile-cli-lib","owner":{"login":"telerik","id":568561,"avatar_url":"https://avatars.githubusercontent.com/u/568561?v=3","gravatar_id":"","url":"https://api.github.com/users/telerik","html_url":"https://github.com/telerik","followers_url":"https://api.github.com/users/telerik/followers","following_url":"https://api.github.com/users/telerik/following{/other_user}","gists_url":"https://api.github.com/users/telerik/gists{/gist_id}","starred_url":"https://api.github.com/users/telerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telerik/subscriptions","organizations_url":"https://api.github.com/users/telerik/orgs","repos_url":"https://api.github.com/users/telerik/repos","events_url":"https://api.github.com/users/telerik/events{/privacy}","received_events_url":"https://api.github.com/users/telerik/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telerik/mobile-cli-lib","description":"Contains common infrastructure for CLIs - mainly AppBuilder, NativeScript and DDB.","fork":false,"url":"https://api.github.com/repos/telerik/mobile-cli-lib","forks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/forks","keys_url":"https://api.github.com/repos/telerik/mobile-cli-lib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telerik/mobile-cli-lib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telerik/mobile-cli-lib/teams","hooks_url":"https://api.github.com/repos/telerik/mobile-cli-lib/hooks","issue_events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/events{/number}","events_url":"https://api.github.com/repos/telerik/mobile-cli-lib/events","assignees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/assignees{/user}","branches_url":"https://api.github.com/repos/telerik/mobile-cli-lib/branches{/branch}","tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/tags","blobs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/refs{/sha}","trees_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/{sha}","languages_url":"https://api.github.com/repos/telerik/mobile-cli-lib/languages","stargazers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/stargazers","contributors_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contributors","subscribers_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscribers","subscription_url":"https://api.github.com/repos/telerik/mobile-cli-lib/subscription","commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/commits{/sha}","git_commits_url":"https://api.github.com/repos/telerik/mobile-cli-lib/git/commits{/sha}","comments_url":"https://api.github.com/repos/telerik/mobile-cli-lib/comments{/number}","issue_comment_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/comments{/number}","contents_url":"https://api.github.com/repos/telerik/mobile-cli-lib/contents/{+path}","compare_url":"https://api.github.com/repos/telerik/mobile-cli-lib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telerik/mobile-cli-lib/merges","archive_url":"https://api.github.com/repos/telerik/mobile-cli-lib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telerik/mobile-cli-lib/downloads","issues_url":"https://api.github.com/repos/telerik/mobile-cli-lib/issues{/number}","pulls_url":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls{/number}","milestones_url":"https://api.github.com/repos/telerik/mobile-cli-lib/milestones{/number}","notifications_url":"https://api.github.com/repos/telerik/mobile-cli-lib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telerik/mobile-cli-lib/labels{/name}","releases_url":"https://api.github.com/repos/telerik/mobile-cli-lib/releases{/id}","created_at":"2014-06-30T10:54:52Z","updated_at":"2015-08-21T03:33:58Z","pushed_at":"2015-11-03T21:56:02Z","git_url":"git://github.com/telerik/mobile-cli-lib.git","ssh_url":"git@github.com:telerik/mobile-cli-lib.git","clone_url":"https://github.com/telerik/mobile-cli-lib.git","svn_url":"https://github.com/telerik/mobile-cli-lib","homepage":"","size":13653,"stargazers_count":7,"watchers_count":7,"language":"TypeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507"},"html":{"href":"https://github.com/telerik/mobile-cli-lib/pull/507"},"issue":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/507"},"comments":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/issues/507/comments"},"review_comments":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507/comments"},"review_comment":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/pulls/507/commits"},"statuses":{"href":"https://api.github.com/repos/telerik/mobile-cli-lib/statuses/d6ea9c3334ca81f9209e44895e4891925d871657"}}}}