osunix / opengrok-trunk

mirror of opengrok

Clone this repository (size: 5.0 MB): HTTPS / SSH
$ hg clone http://hg.pathscale.com/opengrok-trunk
commit 750: bdab6a143036
parent 749: c997c69c6b0a
branch: default
tags: tip
Start a thread to spool stderr for ctags
Tron...@sun.com
19 months ago

Changed (Δ1.1 KB):

Up to file-list src/org/opensolaris/opengrok/analysis/Ctags.java:

@@ -45,6 +45,7 @@ public class Ctags {
45
45
    private static final Logger log = Logger.getLogger(Ctags.class.getName());
46
46
    private String binary;
47
47
    private ProcessBuilder processBuilder;
48
    private Thread errThread;
48
49
49
50
    public void setBinary(String binary) {
50
51
        this.binary = binary;
@@ -81,6 +82,35 @@ public class Ctags {
81
82
        ctags = processBuilder.start();
82
83
        ctagsIn = new OutputStreamWriter(ctags.getOutputStream());
83
84
        ctagsOut = new BufferedReader(new InputStreamReader(ctags.getInputStream()));
85
86
        final BufferedReader error = new BufferedReader(new InputStreamReader(ctags.getErrorStream()));
87
88
        errThread = new Thread(new Runnable() {
89
90
            public void run() {
91
                StringBuilder sb = new StringBuilder();
92
                try {
93
                    String s;
94
                    while ((s = error.readLine()) != null) {
95
                        sb.append(s);
96
                        sb.append('\n');
97
                    }
98
                } catch (IOException exp) {
99
                     log.log(Level.WARNING, "Got an exception reading ctags error stream: ", exp);                
100
                } finally {
101
                    try {
102
                        error.close();
103
                    } catch (IOException exp) {
104
                        log.log(Level.WARNING, "Got an exception closing error stream: ", exp);
105
                    }
106
                }
107
                if (sb.length() > 0) {
108
                     log.warning("Error from ctags: " + sb.toString());
109
                }
110
            }
111
        });
112
        errThread.setDaemon(true);
113
        errThread.start();
84
114
    }
85
115
86
116
    public Definitions doCtags(String file) throws IOException {