mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 21:29:17 +01:00
Make processing-java return an error code if the VM failed
This still doesn't seem to return anything for exceptions inside a sketch, but a start. Error codes could be helpful for automatic regression testing of all examples.
This commit is contained in:
@@ -275,6 +275,7 @@ public class Commander implements RunnerListener {
|
||||
} else {
|
||||
runner.launch(sketchArgs);
|
||||
}
|
||||
success = !runner.vmReturnedError();
|
||||
}
|
||||
} else {
|
||||
success = false;
|
||||
|
||||
@@ -59,6 +59,7 @@ public class Runner implements MessageConsumer {
|
||||
|
||||
// Running remote VM
|
||||
protected VirtualMachine vm;
|
||||
protected boolean vmReturnedError;
|
||||
|
||||
// Thread transferring remote error stream to our error stream
|
||||
protected Thread errThread = null;
|
||||
@@ -130,6 +131,14 @@ public class Runner implements MessageConsumer {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Whether the last invocation of launchJava() was successful or not
|
||||
*/
|
||||
public boolean vmReturnedError() {
|
||||
return vmReturnedError;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Simple non-blocking launch of the virtual machine. VM starts suspended.
|
||||
* @return debuggee VM or null on failure
|
||||
@@ -408,6 +417,7 @@ public class Runner implements MessageConsumer {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
// PApplet.println("java starting");
|
||||
vmReturnedError = false;
|
||||
process = PApplet.exec(args);
|
||||
try {
|
||||
// PApplet.println("java waiting");
|
||||
@@ -445,6 +455,7 @@ public class Runner implements MessageConsumer {
|
||||
// changing this to separate editor and listener [091124]
|
||||
//if (editor != null) {
|
||||
listener.statusError("Could not run the sketch.");
|
||||
vmReturnedError = true;
|
||||
//}
|
||||
// return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user