Bug 522034: [Scripting] fork should return the execution result

Change-Id: Icb3b49006999bfa56cbf6fda45144b41975f5c53
diff --git a/plugins/org.eclipse.ease.modules.platform/src/org/eclipse/ease/modules/platform/ScriptingModule.java b/plugins/org.eclipse.ease.modules.platform/src/org/eclipse/ease/modules/platform/ScriptingModule.java
index f3621bb..20a4665 100644
--- a/plugins/org.eclipse.ease.modules.platform/src/org/eclipse/ease/modules/platform/ScriptingModule.java
+++ b/plugins/org.eclipse.ease.modules.platform/src/org/eclipse/ease/modules/platform/ScriptingModule.java
@@ -17,6 +17,7 @@
 import org.eclipse.ease.IScriptable;
 import org.eclipse.ease.Logger;
 import org.eclipse.ease.Script;
+import org.eclipse.ease.ScriptResult;
 import org.eclipse.ease.modules.AbstractScriptModule;
 import org.eclipse.ease.modules.ScriptParameter;
 import org.eclipse.ease.modules.WrapToScript;
@@ -91,10 +92,10 @@
 	 *            optional script arguments delimited by commas ','
 	 * @param engineID
 	 *            engine ID to be used
-	 * @return script engine instance or <code>null</code> in case of error
+	 * @return execution result
 	 */
 	@WrapToScript
-	public IScriptEngine fork(final Object resource, @ScriptParameter(defaultValue = ScriptParameter.NULL) final String arguments,
+	public ScriptResult fork(final Object resource, @ScriptParameter(defaultValue = ScriptParameter.NULL) final String arguments,
 			@ScriptParameter(defaultValue = ScriptParameter.NULL) String engineID) {
 
 		final IScriptService scriptService = PlatformUI.getWorkbench().getService(IScriptService.class);
@@ -129,18 +130,13 @@
 
 			Object scriptObject = ResourceTools.resolve(resource, getScriptEngine().getExecutedFile());
 			if (scriptObject == null) {
-				try {
-					// no file available, try to resolve URI
-					scriptObject = URI.create(resource.toString());
-				} catch (final IllegalArgumentException e) {
-					// could not resolve URI, giving up
-					return null;
-				}
+				// no file available, try to resolve URI
+				scriptObject = URI.create(resource.toString());
 			}
 
-			engine.executeAsync(scriptObject);
+			final ScriptResult result = engine.executeAsync(scriptObject);
 			engine.schedule();
-			return engine;
+			return result;
 		}
 
 		throw new RuntimeException("No script engine found for source \"" + resource + "\"");