Skip to content
Snippets Groups Projects
Commit 58f15d2b authored by rswindell's avatar rswindell
Browse files

Added support for -x option to terminate script immediately on local abort

(don't wait for script to self-terminate).
parent afe11b61
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,7 @@ char revision[16];
BOOL pause_on_exit=FALSE;
BOOL pause_on_error=FALSE;
BOOL terminated=FALSE;
BOOL terminate_immediately=FALSE;
void banner(FILE* fp)
{
......@@ -87,6 +88,7 @@ void usage(FILE* fp)
"\t-e send error messages to console instead of stderr\n"
"\t-n send status messages to %s instead of stdout\n"
"\t-q send console messages to %s instead of stderr\n"
"\t-x terminate immediately on local abort signal\n"
"\t-p wait for keypress (pause) on exit\n"
"\t-! wait for keypress (pause) on error\n"
,JAVASCRIPT_MAX_BYTES
......@@ -403,6 +405,9 @@ js_BranchCallback(JSContext *cx, JSScript *script)
if(terminated) {
if(terminate_immediately)
return(JS_FALSE);
if(JS_GetProperty(js_cx, js_glob, "server", &val) && val!=JSVAL_VOID)
obj=JSVAL_TO_OBJECT(val);
......@@ -622,7 +627,7 @@ long js_exec(const char *fname, char** args)
void break_handler(int type)
{
fprintf(stderr,"\n-> Terminated Locally (%d)<-\n",type);
fprintf(stderr,"\n-> Terminated Locally (signal: %d)\n",type);
terminated=TRUE;
}
......@@ -689,6 +694,9 @@ int main(int argc, char **argv, char** environ)
case 'n':
statfp=nulfp;
break;
case 'x':
terminate_immediately=TRUE;
break;
case 'p':
pause_on_exit=TRUE;
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment