From 1028dee4dfcd89e914d66d4fe92aaa8fcfbfd494 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Mon, 28 Jul 2014 12:30:16 +0200 Subject: Support pre-compilation of scripts if supported by the engine. Also does this during testing to catch script syntax errors during build. Client shell detects these error and declares them pre-execution. Conflicts: src/main/java/com/c2kernel/scripting/Script.java src/test/java/MainTest.java --- src/main/java/com/c2kernel/process/ClientShell.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main/java/com/c2kernel/process/ClientShell.java') diff --git a/src/main/java/com/c2kernel/process/ClientShell.java b/src/main/java/com/c2kernel/process/ClientShell.java index 9f1d3ab..eeeb07f 100644 --- a/src/main/java/com/c2kernel/process/ClientShell.java +++ b/src/main/java/com/c2kernel/process/ClientShell.java @@ -5,6 +5,7 @@ import java.util.Scanner; import com.c2kernel.entity.proxy.AgentProxy; import com.c2kernel.process.auth.ProxyLogin; import com.c2kernel.scripting.Script; +import com.c2kernel.scripting.ScriptParsingException; public class ClientShell extends StandardClient { @@ -21,13 +22,15 @@ public class ClientShell extends StandardClient { System.out.print("> "); while (scan.hasNextLine()) { String command = scan.nextLine(); - console.setScript(command); try { + console.setScript(command); Object response = console.execute(); if (response == null) System.out.println("Ok"); else System.out.println(response); + } catch (ScriptParsingException e) { + System.err.println("Syntax error: "+e.getMessage()); } catch (Throwable ex) { ex.printStackTrace(); } -- cgit v1.2.3