Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 26348dd4 authored by deuce's avatar deuce

Support terminating the script from the debugger before it actually runs.

parent 8f5b9e0a
......@@ -935,6 +935,7 @@ long js_exec(const char *fname, char** args)
long double start;
long double diff;
JSBool exec_result;
BOOL abort = FALSE;
if(fname!=NULL) {
if(isfullpath(fname)) {
......@@ -1041,21 +1042,25 @@ long js_exec(const char *fname, char** args)
js_PrepareToExecute(js_cx, js_glob, fname==NULL ? NULL : path, orig_cwd, js_glob);
start=xp_timer();
if(debugger)
debug_prompt(js_cx, js_script);
exec_result = JS_ExecuteScript(js_cx, js_glob, js_script, &rval);
JS_GetProperty(js_cx, js_glob, "exit_code", &rval);
if(rval!=JSVAL_VOID && JSVAL_IS_NUMBER(rval)) {
char *p;
JSVALUE_TO_MSTRING(js_cx, rval, p, NULL);
mfprintf(statfp,"Using JavaScript exit_code: %s",p);
free(p);
JS_ValueToInt32(js_cx,rval,&result);
} else if(!exec_result)
abort = debug_prompt(js_cx, js_script) == DEBUG_EXIT;
if (abort) {
result = EXIT_FAILURE;
js_EvalOnExit(js_cx, js_glob, &cb);
JS_ReportPendingException(js_cx);
} else {
exec_result = JS_ExecuteScript(js_cx, js_glob, js_script, &rval);
JS_GetProperty(js_cx, js_glob, "exit_code", &rval);
if(rval!=JSVAL_VOID && JSVAL_IS_NUMBER(rval)) {
char *p;
JSVALUE_TO_MSTRING(js_cx, rval, p, NULL);
mfprintf(statfp,"Using JavaScript exit_code: %s",p);
free(p);
JS_ValueToInt32(js_cx,rval,&result);
} else if(!exec_result)
result = EXIT_FAILURE;
js_EvalOnExit(js_cx, js_glob, &cb);
JS_ReportPendingException(js_cx);
}
if((diff=xp_timer()-start) > 0)
mfprintf(statfp,"%s executed in %.2Lf seconds"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment