Getting process exit code from waitFor()
This commit is contained in:
@@ -343,14 +343,12 @@ public class JetCompiler implements TranslatingCompiler {
|
|||||||
compileContext.addMessage(INFORMATION, "Invoking out-of-process compiler with arguments: " + commandLine, "", -1, -1);
|
compileContext.addMessage(INFORMATION, "Invoking out-of-process compiler with arguments: " + commandLine, "", -1, -1);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Process process = commandLine.createProcess();
|
final Process process = commandLine.createProcess();
|
||||||
final InputStream err = process.getErrorStream();
|
|
||||||
final InputStream out = process.getInputStream();
|
|
||||||
|
|
||||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
parseCompilerMessagesFromReader(compileContext, new InputStreamReader(out), collector);
|
parseCompilerMessagesFromReader(compileContext, new InputStreamReader(process.getInputStream()), collector);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -358,7 +356,7 @@ public class JetCompiler implements TranslatingCompiler {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
FileUtil.loadBytes(err);
|
FileUtil.loadBytes(process.getErrorStream());
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
// Don't care
|
// Don't care
|
||||||
@@ -366,8 +364,8 @@ public class JetCompiler implements TranslatingCompiler {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
process.waitFor();
|
int exitCode = process.waitFor();
|
||||||
handleProcessTermination(process.exitValue(), compileContext);
|
handleProcessTermination(exitCode, compileContext);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
compileContext.addMessage(ERROR, "[Internal Error] " + e.getLocalizedMessage(), "", -1, -1);
|
compileContext.addMessage(ERROR, "[Internal Error] " + e.getLocalizedMessage(), "", -1, -1);
|
||||||
|
|||||||
Reference in New Issue
Block a user