1. bug fix: reset the VM when EOF occurs, which indicates that debug client or debug service exit abnormally
2. make LUA_PATH a system property instead of a command line option to StandardLuaJVM
This commit is contained in:
@@ -53,7 +53,6 @@ public class StandardLuaJVM {
|
||||
protected boolean bSuspendOnStart = false;
|
||||
protected String script;
|
||||
protected String[] scriptArgs;
|
||||
protected String luaPath;
|
||||
protected LuaState state;
|
||||
protected boolean isReady = false;
|
||||
protected boolean isTerminated = false;
|
||||
@@ -123,11 +122,6 @@ public class StandardLuaJVM {
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
if (args[index] != null && args[index].startsWith("-L")) {
|
||||
luaPath = args[index].substring(2); //remove -L fromt the arg
|
||||
index++;
|
||||
}
|
||||
|
||||
String[] scriptArgStrs;
|
||||
if (index != 0) {
|
||||
@@ -184,7 +178,7 @@ public class StandardLuaJVM {
|
||||
}
|
||||
|
||||
String getLuaPath() {
|
||||
return this.luaPath;
|
||||
return System.getProperty("LUA_PATH");
|
||||
}
|
||||
|
||||
public void run() {
|
||||
@@ -235,6 +229,7 @@ public class StandardLuaJVM {
|
||||
LuaC.install();
|
||||
|
||||
// set the lua path if present
|
||||
String luaPath = getLuaPath();
|
||||
if (luaPath != null && luaPath.trim().length() > 0) {
|
||||
PackageLib.setLuaPath(luaPath);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,8 @@ public class ClientConnectionTask implements Runnable, DebugEventListener {
|
||||
}
|
||||
} catch (EOFException e) {
|
||||
// client has terminated the connection
|
||||
// it's time to exit.
|
||||
// it may be time to exit.
|
||||
handleRequest(new DebugMessage(DebugMessageType.reset));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
|
||||
@@ -218,22 +218,24 @@ public class LuaJVMTest extends TestCase {
|
||||
fail("Should never reach this line.");
|
||||
}
|
||||
|
||||
args = new String[] { "-LC:\\lua\\scripts", "dummy.lua" };
|
||||
System.setProperty("LUA_PATH", "c:/work/CSI/prototypes/uidemo/?.lua");
|
||||
args = new String[] {"dummy.lua" };
|
||||
vm = new StandardLuaJVM();
|
||||
try {
|
||||
vm.parse(args);
|
||||
assertEquals("C:\\lua\\scripts", vm.getLuaPath());
|
||||
assertEquals("c:/work/CSI/prototypes/uidemo/?.lua", vm.getLuaPath());
|
||||
assertEquals("dummy.lua", vm.getScript());
|
||||
} catch (ParseException e) {
|
||||
fail("Should never reach this line.");
|
||||
}
|
||||
|
||||
args = new String[] { "-Dport=1044", "-LC:\\lua\\scripts", "dummy.lua" };
|
||||
System.setProperty("LUA_PATH", "c:/work/CSI/prototypes/uidemo/?.lua");
|
||||
args = new String[] { "-Dport=1044", "dummy.lua" };
|
||||
vm = new StandardLuaJVM();
|
||||
try {
|
||||
vm.parse(args);
|
||||
assertEquals(1044, vm.getDebugPort());
|
||||
assertEquals("C:\\lua\\scripts", vm.getLuaPath());
|
||||
assertEquals("c:/work/CSI/prototypes/uidemo/?.lua", vm.getLuaPath());
|
||||
assertEquals("dummy.lua", vm.getScript());
|
||||
} catch (ParseException e) {
|
||||
fail("Should never reach this line.");
|
||||
|
||||
Reference in New Issue
Block a user