1
0
Fork 0

check for serverless mode

This commit is contained in:
Frank Celler 2016-03-17 11:38:29 +01:00
parent b2334b8406
commit f2d9ae0286
1 changed files with 12 additions and 10 deletions

View File

@ -138,7 +138,7 @@ void V8ShellFeature::stop() {
v8::Locker locker{_isolate}; v8::Locker locker{_isolate};
v8::Isolate::Scope isolate_scope{_isolate}; v8::Isolate::Scope isolate_scope{_isolate};
TRI_v8_global_t* v8g = \ TRI_v8_global_t* v8g =
static_cast<TRI_v8_global_t*>(_isolate->GetData(V8DataSlot)); static_cast<TRI_v8_global_t*>(_isolate->GetData(V8DataSlot));
_isolate->SetData(V8DataSlot, nullptr); _isolate->SetData(V8DataSlot, nullptr);
@ -246,8 +246,7 @@ V8ClientConnection* V8ShellFeature::setup(
v8connection = std::make_unique<V8ClientConnection>( v8connection = std::make_unique<V8ClientConnection>(
connection, client->databaseName(), client->username(), connection, client->databaseName(), client->username(),
client->password(), client->requestTimeout()); client->password(), client->requestTimeout());
} } else {
else {
client = nullptr; client = nullptr;
} }
} }
@ -285,8 +284,10 @@ int V8ShellFeature::runShell(std::vector<std::string> const& positionals) {
V8LineEditor v8LineEditor(_isolate, context, "." + _name + ".history"); V8LineEditor v8LineEditor(_isolate, context, "." + _name + ".history");
if (v8connection != nullptr) {
v8LineEditor.setSignalFunction( v8LineEditor.setSignalFunction(
[&v8connection]() { v8connection->setInterrupted(true); }); [&v8connection]() { v8connection->setInterrupted(true); });
}
v8LineEditor.open(_console->autoComplete()); v8LineEditor.open(_console->autoComplete());
@ -372,7 +373,9 @@ int V8ShellFeature::runShell(std::vector<std::string> const& positionals) {
promptError = true; promptError = true;
} }
if (v8connection != nullptr) {
v8connection->setInterrupted(false); v8connection->setInterrupted(false);
}
_console->stopPager(); _console->stopPager();
_console->printLine(""); _console->printLine("");
@ -855,8 +858,7 @@ void V8ShellFeature::initMode(ShellFeature::RunMode runMode,
TRI_AddGlobalVariableVocbase( TRI_AddGlobalVariableVocbase(
_isolate, context, TRI_V8_ASCII_STRING2(_isolate, "IS_UNIT_TESTS"), _isolate, context, TRI_V8_ASCII_STRING2(_isolate, "IS_UNIT_TESTS"),
v8::Boolean::New(_isolate, v8::Boolean::New(_isolate, runMode == ShellFeature::RunMode::UNIT_TESTS));
runMode == ShellFeature::RunMode::UNIT_TESTS));
TRI_AddGlobalVariableVocbase( TRI_AddGlobalVariableVocbase(
_isolate, context, TRI_V8_ASCII_STRING2(_isolate, "IS_JS_LINT"), _isolate, context, TRI_V8_ASCII_STRING2(_isolate, "IS_JS_LINT"),