{"action":"created","issue":{"url":"https://api.github.com/repos/iBotPeaches/Apktool/issues/1809","repository_url":"https://api.github.com/repos/iBotPeaches/Apktool","labels_url":"https://api.github.com/repos/iBotPeaches/Apktool/issues/1809/labels{/name}","comments_url":"https://api.github.com/repos/iBotPeaches/Apktool/issues/1809/comments","events_url":"https://api.github.com/repos/iBotPeaches/Apktool/issues/1809/events","html_url":"https://github.com/iBotPeaches/Apktool/issues/1809","id":328515107,"node_id":"MDU6SXNzdWUzMjg1MTUxMDc=","number":1809,"title":"execAndReturn in OS.java fails to collect command output.","user":{"login":"sunshouxiang","id":26701865,"node_id":"MDQ6VXNlcjI2NzAxODY1","avatar_url":"https://avatars1.githubusercontent.com/u/26701865?v=4","gravatar_id":"","url":"https://api.github.com/users/sunshouxiang","html_url":"https://github.com/sunshouxiang","followers_url":"https://api.github.com/users/sunshouxiang/followers","following_url":"https://api.github.com/users/sunshouxiang/following{/other_user}","gists_url":"https://api.github.com/users/sunshouxiang/gists{/gist_id}","starred_url":"https://api.github.com/users/sunshouxiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunshouxiang/subscriptions","organizations_url":"https://api.github.com/users/sunshouxiang/orgs","repos_url":"https://api.github.com/users/sunshouxiang/repos","events_url":"https://api.github.com/users/sunshouxiang/events{/privacy}","received_events_url":"https://api.github.com/users/sunshouxiang/received_events","type":"User","site_admin":false},"labels":[{"id":195022098,"node_id":"MDU6TGFiZWwxOTUwMjIwOTg=","url":"https://api.github.com/repos/iBotPeaches/Apktool/labels/Waiting%20for%20issuer","name":"Waiting for issuer","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-01T13:14:09Z","updated_at":"2018-06-11T05:15:03Z","closed_at":null,"author_association":"NONE","body":"### Information\r\n1. **Apktool Version (2.3.3)** -\r\n2. **Operating System (Linux)** -\r\n3. **APK From? (Other)** -\r\n\r\n### Stacktrace/Logcat\r\n\r\n```\r\nInclude stacktrace here\r\n```\r\n\r\n### Steps to Reproduce\r\n1. `apktool `\r\n\r\n### Cause\r\n\r\nAlthough you used process.waitFor() to wait for termination of child process, you did not wait for the termination of collector thread. This results in collector.get returns incorrect text as the output of child process might not be collected completely at the point. executor.shutdown and executor.awaitTermination should be used to fix the problem.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/iBotPeaches/Apktool/issues/comments/396124431","html_url":"https://github.com/iBotPeaches/Apktool/issues/1809#issuecomment-396124431","issue_url":"https://api.github.com/repos/iBotPeaches/Apktool/issues/1809","id":396124431,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjEyNDQzMQ==","user":{"login":"sunshouxiang","id":26701865,"node_id":"MDQ6VXNlcjI2NzAxODY1","avatar_url":"https://avatars1.githubusercontent.com/u/26701865?v=4","gravatar_id":"","url":"https://api.github.com/users/sunshouxiang","html_url":"https://github.com/sunshouxiang","followers_url":"https://api.github.com/users/sunshouxiang/followers","following_url":"https://api.github.com/users/sunshouxiang/following{/other_user}","gists_url":"https://api.github.com/users/sunshouxiang/gists{/gist_id}","starred_url":"https://api.github.com/users/sunshouxiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunshouxiang/subscriptions","organizations_url":"https://api.github.com/users/sunshouxiang/orgs","repos_url":"https://api.github.com/users/sunshouxiang/repos","events_url":"https://api.github.com/users/sunshouxiang/events{/privacy}","received_events_url":"https://api.github.com/users/sunshouxiang/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T05:15:03Z","updated_at":"2018-06-11T05:15:03Z","author_association":"NONE","body":"It seems I do not have permission to create a branch for PR, so please refer to the patch output below.\r\n\r\n\t***************\r\n\t*** 14,35 ****\r\n\t--- 14,36 ----\r\n\t   *  See the License for the specific language governing permissions and\r\n\t   *  limitations under the License.\r\n\t   */\r\n\t  package brut.util;\r\n\t  \r\n\t  import brut.common.BrutException;\r\n\t  import java.io.*;\r\n\t  import java.util.Arrays;\r\n\t  import java.util.concurrent.ExecutorService;\r\n\t  import java.util.concurrent.Executors;\r\n\t  import java.util.logging.Logger;\r\n\t+ import java.util.concurrent.TimeUnit;\r\n\t  \r\n\t  import org.apache.commons.io.IOUtils;\r\n\t  \r\n\t  /**\r\n\t   * @author Ryszard Wiśniewski <brut.alll@gmail.com>\r\n\t   */\r\n\t  public class OS {\r\n\t  \r\n\t      private static final Logger LOGGER = Logger.getLogger(\"\");\r\n\t  \r\n\t      public static void rmdir(File dir) throws BrutException {\r\n\t***************\r\n\t*** 105,126 ****\r\n\t--- 106,137 ----\r\n\t      public static String execAndReturn(String[] cmd) {\r\n\t          ExecutorService executor = Executors.newCachedThreadPool();\r\n\t          try {\r\n\t              ProcessBuilder builder = new ProcessBuilder(cmd);\r\n\t              builder.redirectErrorStream(true);\r\n\t  \r\n\t              Process process = builder.start();\r\n\t              StreamCollector collector = new StreamCollector(process.getInputStream());\r\n\t              executor.execute(collector);\r\n\t  \r\n\t              process.waitFor();\r\n\t+             try {\r\n\t+                 if (!executor.awaitTermination(15, TimeUnit.SECONDS)) {\r\n\t+                     executor.shutdownNow();\r\n\t+                     if (!executor.awaitTermination(5, TimeUnit.SECONDS))\r\n\t+                         System.err.println(\"Stream collector did not terminate.\");\r\n\t+                 }\r\n\t+             } catch (InterruptedException ie) {\r\n\t+                 executor.shutdownNow();\r\n\t+                 Thread.currentThread().interrupt();\r\n\t+             }\r\n\t              return collector.get();\r\n\t          } catch (IOException | InterruptedException e) {\r\n\t              return null;\r\n\t          }\r\n\t      }\r\n\t  \r\n\t      public static File createTempDirectory() throws BrutException {\r\n\t          try {\r\n\t              File tmp = File.createTempFile(\"BRUT\", null);\r\n\t              tmp.deleteOnExit();\r\n\t              if (!tmp.delete()) {\r\n"}}
{"actor":{"display_login":"sunshouxiang"}}