From 7780b48539718a59bcec00a82788dd9712dfe853 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Tue, 10 Nov 2015 19:02:30 +0100 Subject: [PATCH] Fix exit code of arangosh if a script threw an exception - meanwhile the TryCatch is also inside. --- arangosh/V8Client/arangosh.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index 81a0ae7fc9..06980fd2c3 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -1728,7 +1728,7 @@ static bool RunScripts (v8::Isolate* isolate, current->ForceSet(TRI_V8_ASCII_STRING("__dirname"), TRI_V8_STRING(dirname)); TRI_FreeString(TRI_CORE_MEM_ZONE, dirname); - TRI_ExecuteGlobalJavaScriptFile(isolate, scripts[i].c_str()); + ok = TRI_ExecuteGlobalJavaScriptFile(isolate, scripts[i].c_str()); // restore old values for __dirname and __filename if (oldFilename.IsEmpty() || oldFilename->IsUndefined()) { @@ -1757,6 +1757,9 @@ static bool RunScripts (v8::Isolate* isolate, ok = false; break; } + if (!ok) { + break; + } } BaseClient.flushLog();