进程完成后发送sysout消息

时间:2017-01-24 10:26:00

标签: java swing

这是我目前的代码:

ProcessBuilder builder = new ProcessBuilder(
                        "cmd.exe", "/c", cmd1 + " && " + cmd2 + " && " + cmd3 + " && " + cmd4 + " && " + cmd5 + " && " + cmd6
                );
                builder.directory(new File(workspace.toString()));
                builder.redirectErrorStream(true);
                Process p = builder.start();
                BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
                String line;
                while(true) {
                    line = r.readLine();
                    if(line == null) {
                        break;
                    }
                    //textPanel.appendText(line);
                    System.err.println(line);
                    textPanel.appendText(line);

                }

如何检查所有命令是否成功执行,cmd6完成后,它会发送一条sysout消息?

我无法弄清楚如何做到这一点......

0 个答案:

没有答案