{"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments/91415950","pull_request_review_id":11924463,"id":91415950,"diff_hunk":"@@ -362,36 +371,32 @@ class WebDriverAgent {\n \n     let agentUrl;\n     let lineCount = 0;\n-    let reachedEnd = !this.realDevice; // simulator does not need to wait, since we are tailing\n     let showWaitingMessage = true; // turn off logging once we have hit the end\n \n     let startDetector = (stdout) => {\n-      // on a real device there may already be system logs that need to be\n-      // passed before we get to the real startup logs, otherwise\n-      // we expect two lines, one after another\n-      //     Jul 20 13:03:57 iamPhone XCTRunner[296] <Warning>: Built at Jul 20 2016 13:03:50\n-      //     Jul 20 13:03:57 iamPhone XCTRunner[296] <Warning>: ServerURLHere->http://10.35.4.122:8100<-ServerURLHere\n-      if (!reachedEnd) {\n-        let dateMatch = REAL_DEVICE_BUILD_LOG_STARTTIME_REGEX.exec(stdout);\n-        if (dateMatch) {\n-          let buildTime = new Date(dateMatch[1]);\n-          if (buildTime.isAfter(startTime)) {\n-            reachedEnd = true;\n+      let match = AGENT_STARTED_REGEX.exec(stdout);\n+      if (match) {\n+        if (this.realDevice) {\n+          // on a real device there may already be system logs that need to be\n+          // passed before we get to the real startup logs, otherwise\n+          // it will be \"done\" before booting\n+          // Expect a line like:\n+          //     Dec  7 10:55:32 iamPhone XCTRunner(WebDriverAgentLib)[386] <Notice>: ServerURLHere->http://localhost:8100<-ServerURLHere\n+          // need to get the date and add the year from the start date\n+          let dateString = `${stdout.substr(0, 6)} ${startTime.getFullYear()} ${stdout.substr(7, 8)}`;\n+          let buildTime = new Date(dateString);\n+          if (!buildTime.isAfter(startTime)) {\n+            return false;\n           }\n         }\n-      }\n \n-      if (reachedEnd) {\n-        let match = AGENT_STARTED_REGEX.exec(stdout);\n-        if (match) {\n-          agentUrl = match[1];\n-          log.info(`Detected that WebDriverAgent is running at url '${agentUrl}'`);\n-          if (!agentUrl) {\n-            log.errorAndThrow(new Error('No url detected from WebDriverAgent'));\n-          }\n-          showWaitingMessage = false;\n-          return true;\n+        agentUrl = match[1];\n+        log.info(`Detected that WebDriverAgent is running at url '${agentUrl}'`);\n+        if (!agentUrl) {","path":"lib/webdriveragent.js","position":91,"original_position":91,"commit_id":"ee88f10d3ca4f5e3608d8d3a4e5bcdfff0bcccbb","original_commit_id":"ee88f10d3ca4f5e3608d8d3a4e5bcdfff0bcccbb","user":{"login":"jlipps","id":605053,"avatar_url":"https://avatars.githubusercontent.com/u/605053?v=3","gravatar_id":"","url":"https://api.github.com/users/jlipps","html_url":"https://github.com/jlipps","followers_url":"https://api.github.com/users/jlipps/followers","following_url":"https://api.github.com/users/jlipps/following{/other_user}","gists_url":"https://api.github.com/users/jlipps/gists{/gist_id}","starred_url":"https://api.github.com/users/jlipps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlipps/subscriptions","organizations_url":"https://api.github.com/users/jlipps/orgs","repos_url":"https://api.github.com/users/jlipps/repos","events_url":"https://api.github.com/users/jlipps/events{/privacy}","received_events_url":"https://api.github.com/users/jlipps/received_events","type":"User","site_admin":false},"body":"maybe move this above the log, otherwise we'd get `Detected that WebDriverAgent is running at url 'undefined'`, which is less helpful than the error message?","created_at":"2016-12-08T00:00:15Z","updated_at":"2016-12-08T00:00:32Z","html_url":"https://github.com/appium/appium-xcuitest-driver/pull/319#discussion_r91415950","pull_request_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments/91415950"},"html":{"href":"https://github.com/appium/appium-xcuitest-driver/pull/319#discussion_r91415950"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319"}}},"pull_request":{"url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319","id":97033096,"html_url":"https://github.com/appium/appium-xcuitest-driver/pull/319","diff_url":"https://github.com/appium/appium-xcuitest-driver/pull/319.diff","patch_url":"https://github.com/appium/appium-xcuitest-driver/pull/319.patch","issue_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/319","number":319,"state":"open","locked":false,"title":"Fix handling of real device timestamp","user":{"login":"imurchie","id":2614354,"avatar_url":"https://avatars.githubusercontent.com/u/2614354?v=3","gravatar_id":"","url":"https://api.github.com/users/imurchie","html_url":"https://github.com/imurchie","followers_url":"https://api.github.com/users/imurchie/followers","following_url":"https://api.github.com/users/imurchie/following{/other_user}","gists_url":"https://api.github.com/users/imurchie/gists{/gist_id}","starred_url":"https://api.github.com/users/imurchie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imurchie/subscriptions","organizations_url":"https://api.github.com/users/imurchie/orgs","repos_url":"https://api.github.com/users/imurchie/repos","events_url":"https://api.github.com/users/imurchie/events{/privacy}","received_events_url":"https://api.github.com/users/imurchie/received_events","type":"User","site_admin":false},"body":"The way in which we see that WDA is running has changed. Previously it would\r\nprint in the device logs two lines, one after another\r\n\r\n```\r\nJul 20 13:03:57 iamPhone XCTRunner[296] <Warning>: Built at Jul 20 2016 13:03:50\r\nJul 20 13:03:57 iamPhone XCTRunner[296] <Warning>: ServerURLHere->http://10.35.4.122:8100<-ServerURLHere\r\n```\r\n\r\nWe would look at the first line to get the date, so that for real devices we did\r\nnot get some old lines from the logs (on sims we tail the logs, so it is not an\r\nissue).\r\n\r\nThis has changed. Now I'm seeing\r\n\r\n```\r\nDec  7 10:55:32 iamPhone XCTRunner(WebDriverAgentLib)[386] <Notice>: Built at Dec  7 2016 09:52:17\r\nDec  7 10:55:32 iamPhone testmanagerd[382] <Notice>: <private>\r\nDec  7 10:55:32 iamPhone duetexpertd(QueryPrediction)[167] <Error>: Missing results from Connections.\r\nDec  7 10:55:32 iamPhone duetexpertd(DuetExpertCenter)[167] <Info>: Total prediction time: 9.763208ms for expert <private>\r\nDec  7 10:55:32 iamPhone duetexpertd(QueryPrediction)[167] <Error>: Missing results from Connections.\r\nDec  7 10:55:32 iamPhone duetexpertd(DuetExpertCenter)[167] <Info>: Total prediction time: 3.531333ms for expert <private>\r\nDec  7 10:55:32 iamPhone XCTRunner(WebDriverAgentLib)[386] <Notice>: ServerURLHere->http://localhost:8100<-ServerURLHere\r\nDec  7 10:55:32 iamPhone XCTRunner(WebDriverAgentLib)[386] <Notice>: Listening on USB\r\n```\r\n\r\nSo rather than getting the date from the \"Built at\" line, get it from the \r\nbeginning of the \"ServerURLHere\" line, and parse it.\r\n\r\nThis also moves from getting the local system time to check for start, and\r\ninstead gets the device time (using `idevicedate` (part of `libimobiledevice`)). This has been tested by\r\nmanually changing the timezone on the device and all works. There _is_ potential\r\nconfusion when you change the time to and _earlier_ time, since the entire\r\nchecking of timestamps is there to make sure that we get the latest log entries,\r\nand we might have ones that are later than the adjusted time.\r\n\r\nFixes https://github.com/appium/appium/issues/7313\r\n\r\n**Also:** Adds a check for the permissions error that comes when trying to write to \r\nthe attachments folder and not having permissions, so that we don't start\r\nshowing the Xcode logs from that point on.","created_at":"2016-12-07T23:56:03Z","updated_at":"2016-12-08T00:00:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e68e3d6cfe43c35d55f3c93be39e9abae3b1b428","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319/commits","review_comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319/comments","review_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/319/comments","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/ee88f10d3ca4f5e3608d8d3a4e5bcdfff0bcccbb","head":{"label":"appium:isaac-new-rd","ref":"isaac-new-rd","sha":"ee88f10d3ca4f5e3608d8d3a4e5bcdfff0bcccbb","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":47652761,"name":"appium-xcuitest-driver","full_name":"appium/appium-xcuitest-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-xcuitest-driver","description":"Appium iOS driver, backed by Apple XCUITest ","fork":false,"url":"https://api.github.com/repos/appium/appium-xcuitest-driver","forks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/deployments","created_at":"2015-12-08T22:11:37Z","updated_at":"2016-12-07T16:21:52Z","pushed_at":"2016-12-07T23:56:03Z","git_url":"git://github.com/appium/appium-xcuitest-driver.git","ssh_url":"git@github.com:appium/appium-xcuitest-driver.git","clone_url":"https://github.com/appium/appium-xcuitest-driver.git","svn_url":"https://github.com/appium/appium-xcuitest-driver","homepage":null,"size":14307,"stargazers_count":68,"watchers_count":68,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":3,"forks":41,"open_issues":3,"watchers":68,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"2beca65f3b8a8b67faba860367d98e94fcf5d683","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":47652761,"name":"appium-xcuitest-driver","full_name":"appium/appium-xcuitest-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-xcuitest-driver","description":"Appium iOS driver, backed by Apple XCUITest ","fork":false,"url":"https://api.github.com/repos/appium/appium-xcuitest-driver","forks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/deployments","created_at":"2015-12-08T22:11:37Z","updated_at":"2016-12-07T16:21:52Z","pushed_at":"2016-12-07T23:56:03Z","git_url":"git://github.com/appium/appium-xcuitest-driver.git","ssh_url":"git@github.com:appium/appium-xcuitest-driver.git","clone_url":"https://github.com/appium/appium-xcuitest-driver.git","svn_url":"https://github.com/appium/appium-xcuitest-driver","homepage":null,"size":14307,"stargazers_count":68,"watchers_count":68,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":3,"forks":41,"open_issues":3,"watchers":68,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319"},"html":{"href":"https://github.com/appium/appium-xcuitest-driver/pull/319"},"issue":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/319"},"comments":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/319/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/319/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/ee88f10d3ca4f5e3608d8d3a4e5bcdfff0bcccbb"}}}}
{"actor":{"display_login":"jlipps"}}