From 137ace24db94d85b6923f9a531e96356ed65ba43 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Wed, 6 Aug 2014 13:06:55 +0400 Subject: [PATCH] Handling return value of run_int by setting exit code. --- src/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 266323294..5af6f3d43 100644 --- a/src/main.c +++ b/src/main.c @@ -68,7 +68,7 @@ parser_run (const char *script_source, size_t script_source_size, bool is_show_o return opcodes; } -static void +static int jerry_run (const char *script_source, size_t script_source_size, bool is_parse_only, bool is_show_opcodes) { @@ -82,12 +82,12 @@ jerry_run (const char *script_source, size_t script_source_size, bool is_parse_o if (is_parse_only) { - return; + return 0; } init_int (opcodes); - run_int (); + return run_int () ? 0 : 1; } /* jerry_run */ #ifdef __TARGET_HOST_x64 @@ -199,13 +199,14 @@ main (int argc __unused, size_t source_size; const char *source_p = read_sources (file_names, files_counter, &source_size); - jerry_run (source_p, source_size, parse_only, show_opcodes); + int ret = jerry_run (source_p, source_size, parse_only, show_opcodes); if (print_mem_stats) { mem_heap_print( false, false, true); } - return 0; + + return ret; } #endif