src/jdk.jpackage/share/classes/jdk/jpackage/internal/IOUtils.java
branchJDK-8200758-branch
changeset 57446 5a5b85f00a63
parent 57438 4a31db8d42bd
child 58301 e0efb29609bd
equal deleted inserted replaced
57445:405ddd80496e 57446:5a5b85f00a63
   189                 + (pb.directory() != null ? (" in " + pb.directory()) : ""));
   189                 + (pb.directory() != null ? (" in " + pb.directory()) : ""));
   190         Process p = pb.start();
   190         Process p = pb.start();
   191         InputStreamReader isr = new InputStreamReader(p.getInputStream());
   191         InputStreamReader isr = new InputStreamReader(p.getInputStream());
   192         BufferedReader br = new BufferedReader(isr);
   192         BufferedReader br = new BufferedReader(isr);
   193         String lineRead;
   193         String lineRead;
       
   194         String output = "";
   194         while ((lineRead = br.readLine()) != null) {
   195         while ((lineRead = br.readLine()) != null) {
   195             if (consumer != null) {
   196             if (consumer != null) {
   196                 consumer.print(lineRead + '\n');
   197                 consumer.print(lineRead + '\n');
   197             } else {
   198             } else {
   198                Log.verbose(lineRead);
   199                Log.verbose(lineRead);
   199             }
   200             }
       
   201             output += lineRead;
   200         }
   202         }
   201         try {
   203         try {
   202             int ret = p.waitFor();
   204             int ret = p.waitFor();
   203             if (ret != 0 && !(testForPresenseOnly && ret != 127)) {
   205             if (ret != 0 && !(testForPresenseOnly && ret != 127)) {
   204                 throw new IOException("Exec failed with code "
   206                 throw new IOException("Exec failed with code "
   205                         + ret + " command ["
   207                         + ret + " command ["
   206                         + Arrays.toString(pb.command().toArray(new String[0]))
   208                         + Arrays.toString(pb.command().toArray(new String[0]))
   207                         + " in " + (pb.directory() != null ?
   209                         + " in " + (pb.directory() != null ?
   208                                 pb.directory().getAbsolutePath() :
   210                                 pb.directory().getAbsolutePath() :
   209                                 "unspecified directory"));
   211                                 "unspecified directory")
       
   212                         + " output: " + output);
   210             }
   213             }
   211         } catch (InterruptedException ex) {
   214         } catch (InterruptedException ex) {
   212         }
   215         }
   213     }
   216     }
   214 
   217