{"action":"created","comment":{"url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments/183686630","pull_request_review_id":114729527,"id":183686630,"diff_hunk":"@@ -855,14 +871,57 @@ public boolean pkgInstall(List<String> packageIdsToInstall) {\n      */\n     public boolean pkgInstall(List<String> packageIdsToInstall, boolean ignoreMissing) {\n         log.debug(\"Installing: \" + packageIdsToInstall);\n-        for (String pkgId : packageIdsToInstall) {\n+        Queue<String> remaining = new LinkedList<>(packageIdsToInstall);\n+        while (!remaining.isEmpty()) {\n+            String pkgId = remaining.poll();\n             if (pkgInstall(pkgId, ignoreMissing) == null && !ignoreMissing) {\n                 return false;\n             }\n+            if (isLauncherChanged()) {\n+                // TODO Handle ignoreMissing?\n+                persistPendingCommand(CommandInfo.CMD_INSTALL, remaining);\n+                throw new LauncherRestartException();\n+            }\n         }\n         return true;\n     }\n \n+    /**\n+     * Persists the pending package operation into file system. It's useful when Nuxeo launcher is about to exit.\n+     * <p>\n+     * The given commands will be appended as lines to the target file, {@link #INSTALL_AFTER_RESTART}.\n+     *\n+     * @param commands commands to persist, each string is an individual command\n+     * @throws IllegalStateException if any exception occurs\n+     * @see #INSTALL_AFTER_RESTART\n+     * @since 10.2\n+     */\n+    protected void persistPendingCommands(Iterable<String> commands) {\n+        Path path = getInstallAfterRestartPath();\n+        try {\n+            Files.write(path, commands, StandardOpenOption.CREATE, StandardOpenOption.APPEND);\n+        } catch (IOException e) {\n+            throw new IllegalStateException(\"Cannot write to file \" + path, e);","path":"nuxeo-runtime/nuxeo-connect-standalone/src/main/java/org/nuxeo/launcher/connect/ConnectBroker.java","position":null,"original_position":122,"commit_id":"c76e27f6edb0cd868b5f214beaa44374512cde5b","original_commit_id":"cd75bdd5650c95296edd7e6d4fdc0acda8f612b0","user":{"login":"mincong-h","id":10179217,"avatar_url":"https://avatars3.githubusercontent.com/u/10179217?v=4","gravatar_id":"","url":"https://api.github.com/users/mincong-h","html_url":"https://github.com/mincong-h","followers_url":"https://api.github.com/users/mincong-h/followers","following_url":"https://api.github.com/users/mincong-h/following{/other_user}","gists_url":"https://api.github.com/users/mincong-h/gists{/gist_id}","starred_url":"https://api.github.com/users/mincong-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mincong-h/subscriptions","organizations_url":"https://api.github.com/users/mincong-h/orgs","repos_url":"https://api.github.com/users/mincong-h/repos","events_url":"https://api.github.com/users/mincong-h/events{/privacy}","received_events_url":"https://api.github.com/users/mincong-h/received_events","type":"User","site_admin":false},"body":"According to the Javadoc of method `Files#write`: _throws IOException if an I/O error occurs writing to or creating the file, or the text cannot be encoded `UTF-8`_. I added a unit test.","created_at":"2018-04-24T10:53:28Z","updated_at":"2018-04-24T10:53:28Z","html_url":"https://github.com/nuxeo/nuxeo/pull/1955#discussion_r183686630","pull_request_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments/183686630"},"html":{"href":"https://github.com/nuxeo/nuxeo/pull/1955#discussion_r183686630"},"pull_request":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955"}},"in_reply_to_id":183451740},"pull_request":{"url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955","id":183477559,"html_url":"https://github.com/nuxeo/nuxeo/pull/1955","diff_url":"https://github.com/nuxeo/nuxeo/pull/1955.diff","patch_url":"https://github.com/nuxeo/nuxeo/pull/1955.patch","issue_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/1955","number":1955,"state":"open","locked":false,"title":"[WIP] Fix nxp 24507 nuxeoctl forgot pending packages 9.10","user":{"login":"mincong-h","id":10179217,"avatar_url":"https://avatars3.githubusercontent.com/u/10179217?v=4","gravatar_id":"","url":"https://api.github.com/users/mincong-h","html_url":"https://github.com/mincong-h","followers_url":"https://api.github.com/users/mincong-h/followers","following_url":"https://api.github.com/users/mincong-h/following{/other_user}","gists_url":"https://api.github.com/users/mincong-h/gists{/gist_id}","starred_url":"https://api.github.com/users/mincong-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mincong-h/subscriptions","organizations_url":"https://api.github.com/users/mincong-h/orgs","repos_url":"https://api.github.com/users/mincong-h/repos","events_url":"https://api.github.com/users/mincong-h/events{/privacy}","received_events_url":"https://api.github.com/users/mincong-h/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-23T15:44:36Z","updated_at":"2018-04-24T10:53:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07270fcf59ecb21c11425cc526a3f5ed9fb69860","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955/commits","review_comments_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955/comments","review_comment_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/1955/comments","statuses_url":"https://api.github.com/repos/nuxeo/nuxeo/statuses/c76e27f6edb0cd868b5f214beaa44374512cde5b","head":{"label":"nuxeo:wip/fix-NXP-24507-nuxeoctl-forgot-pending-packages-9.10","ref":"wip/fix-NXP-24507-nuxeoctl-forgot-pending-packages-9.10","sha":"c76e27f6edb0cd868b5f214beaa44374512cde5b","user":{"login":"nuxeo","id":460607,"avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"repo":{"id":2988101,"name":"nuxeo","full_name":"nuxeo/nuxeo","owner":{"login":"nuxeo","id":460607,"avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nuxeo/nuxeo","description":"Content management platform to build modern business applications","fork":false,"url":"https://api.github.com/repos/nuxeo/nuxeo","forks_url":"https://api.github.com/repos/nuxeo/nuxeo/forks","keys_url":"https://api.github.com/repos/nuxeo/nuxeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nuxeo/nuxeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nuxeo/nuxeo/teams","hooks_url":"https://api.github.com/repos/nuxeo/nuxeo/hooks","issue_events_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/events{/number}","events_url":"https://api.github.com/repos/nuxeo/nuxeo/events","assignees_url":"https://api.github.com/repos/nuxeo/nuxeo/assignees{/user}","branches_url":"https://api.github.com/repos/nuxeo/nuxeo/branches{/branch}","tags_url":"https://api.github.com/repos/nuxeo/nuxeo/tags","blobs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nuxeo/nuxeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/nuxeo/nuxeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nuxeo/nuxeo/statuses/{sha}","languages_url":"https://api.github.com/repos/nuxeo/nuxeo/languages","stargazers_url":"https://api.github.com/repos/nuxeo/nuxeo/stargazers","contributors_url":"https://api.github.com/repos/nuxeo/nuxeo/contributors","subscribers_url":"https://api.github.com/repos/nuxeo/nuxeo/subscribers","subscription_url":"https://api.github.com/repos/nuxeo/nuxeo/subscription","commits_url":"https://api.github.com/repos/nuxeo/nuxeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/nuxeo/nuxeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/nuxeo/nuxeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/nuxeo/nuxeo/contents/{+path}","compare_url":"https://api.github.com/repos/nuxeo/nuxeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nuxeo/nuxeo/merges","archive_url":"https://api.github.com/repos/nuxeo/nuxeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nuxeo/nuxeo/downloads","issues_url":"https://api.github.com/repos/nuxeo/nuxeo/issues{/number}","pulls_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls{/number}","milestones_url":"https://api.github.com/repos/nuxeo/nuxeo/milestones{/number}","notifications_url":"https://api.github.com/repos/nuxeo/nuxeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nuxeo/nuxeo/labels{/name}","releases_url":"https://api.github.com/repos/nuxeo/nuxeo/releases{/id}","deployments_url":"https://api.github.com/repos/nuxeo/nuxeo/deployments","created_at":"2011-12-15T14:35:41Z","updated_at":"2018-04-24T10:03:00Z","pushed_at":"2018-04-24T09:38:37Z","git_url":"git://github.com/nuxeo/nuxeo.git","ssh_url":"git@github.com:nuxeo/nuxeo.git","clone_url":"https://github.com/nuxeo/nuxeo.git","svn_url":"https://github.com/nuxeo/nuxeo","homepage":"http://www.nuxeo.com","size":227561,"stargazers_count":204,"watchers_count":204,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":146,"mirror_url":null,"archived":false,"open_issues_count":13,"license":null,"forks":146,"open_issues":13,"watchers":204,"default_branch":"master"}},"base":{"label":"nuxeo:9.10","ref":"9.10","sha":"2e01e338ed9f96c75f1547dd676a8d3ca37f88f0","user":{"login":"nuxeo","id":460607,"avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"repo":{"id":2988101,"name":"nuxeo","full_name":"nuxeo/nuxeo","owner":{"login":"nuxeo","id":460607,"avatar_url":"https://avatars1.githubusercontent.com/u/460607?v=4","gravatar_id":"","url":"https://api.github.com/users/nuxeo","html_url":"https://github.com/nuxeo","followers_url":"https://api.github.com/users/nuxeo/followers","following_url":"https://api.github.com/users/nuxeo/following{/other_user}","gists_url":"https://api.github.com/users/nuxeo/gists{/gist_id}","starred_url":"https://api.github.com/users/nuxeo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuxeo/subscriptions","organizations_url":"https://api.github.com/users/nuxeo/orgs","repos_url":"https://api.github.com/users/nuxeo/repos","events_url":"https://api.github.com/users/nuxeo/events{/privacy}","received_events_url":"https://api.github.com/users/nuxeo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nuxeo/nuxeo","description":"Content management platform to build modern business applications","fork":false,"url":"https://api.github.com/repos/nuxeo/nuxeo","forks_url":"https://api.github.com/repos/nuxeo/nuxeo/forks","keys_url":"https://api.github.com/repos/nuxeo/nuxeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nuxeo/nuxeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nuxeo/nuxeo/teams","hooks_url":"https://api.github.com/repos/nuxeo/nuxeo/hooks","issue_events_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/events{/number}","events_url":"https://api.github.com/repos/nuxeo/nuxeo/events","assignees_url":"https://api.github.com/repos/nuxeo/nuxeo/assignees{/user}","branches_url":"https://api.github.com/repos/nuxeo/nuxeo/branches{/branch}","tags_url":"https://api.github.com/repos/nuxeo/nuxeo/tags","blobs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nuxeo/nuxeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nuxeo/nuxeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/nuxeo/nuxeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nuxeo/nuxeo/statuses/{sha}","languages_url":"https://api.github.com/repos/nuxeo/nuxeo/languages","stargazers_url":"https://api.github.com/repos/nuxeo/nuxeo/stargazers","contributors_url":"https://api.github.com/repos/nuxeo/nuxeo/contributors","subscribers_url":"https://api.github.com/repos/nuxeo/nuxeo/subscribers","subscription_url":"https://api.github.com/repos/nuxeo/nuxeo/subscription","commits_url":"https://api.github.com/repos/nuxeo/nuxeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/nuxeo/nuxeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/nuxeo/nuxeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/nuxeo/nuxeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/nuxeo/nuxeo/contents/{+path}","compare_url":"https://api.github.com/repos/nuxeo/nuxeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nuxeo/nuxeo/merges","archive_url":"https://api.github.com/repos/nuxeo/nuxeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nuxeo/nuxeo/downloads","issues_url":"https://api.github.com/repos/nuxeo/nuxeo/issues{/number}","pulls_url":"https://api.github.com/repos/nuxeo/nuxeo/pulls{/number}","milestones_url":"https://api.github.com/repos/nuxeo/nuxeo/milestones{/number}","notifications_url":"https://api.github.com/repos/nuxeo/nuxeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nuxeo/nuxeo/labels{/name}","releases_url":"https://api.github.com/repos/nuxeo/nuxeo/releases{/id}","deployments_url":"https://api.github.com/repos/nuxeo/nuxeo/deployments","created_at":"2011-12-15T14:35:41Z","updated_at":"2018-04-24T10:03:00Z","pushed_at":"2018-04-24T09:38:37Z","git_url":"git://github.com/nuxeo/nuxeo.git","ssh_url":"git@github.com:nuxeo/nuxeo.git","clone_url":"https://github.com/nuxeo/nuxeo.git","svn_url":"https://github.com/nuxeo/nuxeo","homepage":"http://www.nuxeo.com","size":227561,"stargazers_count":204,"watchers_count":204,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":146,"mirror_url":null,"archived":false,"open_issues_count":13,"license":null,"forks":146,"open_issues":13,"watchers":204,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955"},"html":{"href":"https://github.com/nuxeo/nuxeo/pull/1955"},"issue":{"href":"https://api.github.com/repos/nuxeo/nuxeo/issues/1955"},"comments":{"href":"https://api.github.com/repos/nuxeo/nuxeo/issues/1955/comments"},"review_comments":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955/comments"},"review_comment":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nuxeo/nuxeo/pulls/1955/commits"},"statuses":{"href":"https://api.github.com/repos/nuxeo/nuxeo/statuses/c76e27f6edb0cd868b5f214beaa44374512cde5b"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"mincong-h"}}