summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/ejs/smbscript.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source4/scripting/ejs/smbscript.c b/source4/scripting/ejs/smbscript.c
index 754a49ccb1..323e604f8d 100644
--- a/source4/scripting/ejs/smbscript.c
+++ b/source4/scripting/ejs/smbscript.c
@@ -35,7 +35,8 @@ void ejs_exception(const char *reason)
EjsId eid;
EjsHandle handle = 0;
MprVar result;
- char *emsg;
+ char *emsg, *script;
+ size_t script_size;
TALLOC_CTX *mem_ctx = talloc_new(NULL);
const char **argv_list = NULL;
struct MprVar v;
@@ -79,10 +80,12 @@ void ejs_exception(const char *reason)
v = mprList("ARGV", argv_list);
mprCreateProperty(ejsGetGlobalObject(eid), "ARGV", &v);
+ /* load the script and advance past interpreter line*/
+ script = file_load(argv[1], &script_size);
+
/* run the script */
- if (ejsEvalFile(eid, discard_const_p(char, argv[1]), &result,
- &emsg) == -1) {
- fprintf(stderr, "smbscript: ejsEvalFile(): %s\n", emsg);
+ if (ejsEvalScript(eid, script, &result, &emsg) == -1) {
+ fprintf(stderr, "smbscript: ejsEvalScript(): %s\n", emsg);
exit(1);
}