8000 check for serverless mode · lethalbrains/arangodb@f2d9ae0 · GitHub
[go: up one dir, main page]

Skip to content

Commit f2d9ae0

Browse files
committed
check for serverless mode
1 parent b2334b8 commit f2d9ae0

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

arangosh/Shell/V8ShellFeature.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ void V8ShellFeature::stop() {
138138
v8::Locker locker{_isolate};
139139
v8::Isolate::Scope isolate_scope{_isolate};
140140

141-
TRI_v8_global_t* v8g = \
142-
static_cast<TRI_v8_global_t*>(_isolate->GetData(V8DataSlot));
141+
TRI_v8_global_t* v8g =
142+
static_cast<TRI_v8_global_t*>(_isolate->GetData(V8DataSlot));
143143
_isolate->SetData(V8DataSlot, nullptr);
144144

145145
delete v8g;
@@ -246,8 +246,7 @@ V8ClientConnection* V8ShellFeature::setup(
246246
v8connection = std::make_unique<V8ClientConnection>(
247247
connection, client->databaseName(), client->username(),
248248
client->password(), client->requestTimeout());
249-
}
250-
else {
249+
} else {
251250
client = nullptr;
252251
}
253252
}
@@ -285,8 +284,10 @@ int V8ShellFeature::runShell(std::vector<std::string> const& positionals) {
285284

286285
V8LineEditor v8LineEditor(_isolate, context, "." + _name + ".history");
287286

288-
v8LineEditor.setSignalFunction(
289-
[&v8connection]() { v8connection->setInterrupted(true); });
287+
if (v8connection != nullptr) {
288+
v8LineEditor.setSignalFunction(
289+
[&v8connection]() { v8connection->setInterrupted(true); });
290+
}
290291

291292
v8LineEditor.open(_console->autoComplete());
292293

@@ -372,7 +373,9 @@ int V8ShellFeature::runShell(std::vector<std::string> const& positionals) {
372373
promptError = true;
373374
}
374375

375-
v8connection->setInterrupted(false);
376+
if (v8connection != nullptr) {
377+
v8connection->setInterrupted(false);
378+
}
376379

377380
_console->stopPager();
378381
_console->printLine("");
@@ -566,7 +569,7 @@ bool V8ShellFeature::jslint(std::vector<std::string> const& files) {
566569
TRI_ExecuteJavaScriptString(_isolate, context, input, name, true);
567570

568571
if (tryCatch.HasCaught()) {
569-
LOG(ERR) << TRI_StringifyV8Exception(_isolate, &tryCatch);
572+
LOG(ERR) << TRI_StringifyV8Exception(_isolate, &tryCatch);
570573
ok = false;
571574
} else {
572575
bool res = TRI_ObjectToBoolean(context->Global()->Get(
@@ -855,8 +858,7 @@ void V8ShellFeature::initMode(ShellFeature::RunMode runMode,
855858

856859
TRI_AddGlobalVariableVocbase(
857860
_isolate, context, TRI_V8_ASCII_STRING2(_isolate, "IS_UNIT_TESTS"),
858-
v8::Boolean::New(_isolate,
859-
runMode == ShellFeature::RunMode::UNIT_TESTS));
861+
v8::Boolean::New(_isolate, runMode == ShellFeature::RunMode::UNIT_TESTS));
860862

861863
TRI_AddGlobalVariableVocbase(
862864
_isolate, context, TRI_V8_ASCII_STRING2(_isolate, "IS_JS_LINT"),

0 commit comments

Comments
 (0)
0