mirror of https://gitee.com/bigwinds/arangodb
Fix ICU path building, windows codepage correctness (#6679)
This commit is contained in:
parent
8667a8e001
commit
73ee5cb40e
|
@ -53,7 +53,8 @@ ServerFeature::ServerFeature(
|
|||
_vstMaxSize(1024 * 30),
|
||||
_result(res),
|
||||
_operationMode(OperationMode::MODE_SERVER),
|
||||
_codePage(65001) { // default to UTF8
|
||||
_codePage(65001), // default to UTF8
|
||||
_originalCodePage(UINT16_MAX) {
|
||||
setOptional(true);
|
||||
|
||||
startsAfter("AQLPhase");
|
||||
|
@ -158,7 +159,10 @@ void ServerFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {
|
|||
|
||||
void ServerFeature::start() {
|
||||
#if _WIN32
|
||||
SetConsoleOutputCP(_codePage);
|
||||
_originalCodePage = GetConsoleOutputCP();
|
||||
if (IsValidCodePage(_codePage)) {
|
||||
SetConsoleOutputCP(_codePage);
|
||||
}
|
||||
#endif
|
||||
|
||||
waitForHeartbeat();
|
||||
|
@ -189,6 +193,14 @@ void ServerFeature::start() {
|
|||
|
||||
}
|
||||
|
||||
void ServerFeature::stop() {
|
||||
#if _WIN32
|
||||
if (IsValidCodePage(_originalCodePage)) {
|
||||
SetConsoleOutputCP(_originalCodePage);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ServerFeature::beginShutdown() {
|
||||
std::string msg =
|
||||
ArangoGlobalContext::CONTEXT->binaryName() + " [shutting down]";
|
||||
|
|
|
@ -44,6 +44,7 @@ class ServerFeature final : public application_features::ApplicationFeature {
|
|||
void collectOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void validateOptions(std::shared_ptr<options::ProgramOptions>) override final;
|
||||
void start() override final;
|
||||
void stop() override final;
|
||||
void beginShutdown() override final;
|
||||
bool isStopping() const { return _isStopping; }
|
||||
|
||||
|
@ -71,6 +72,7 @@ class ServerFeature final : public application_features::ApplicationFeature {
|
|||
OperationMode _operationMode;
|
||||
bool _isStopping = false;
|
||||
uint16_t _codePage;
|
||||
uint16_t _originalCodePage;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ ClientFeature::ClientFeature(
|
|||
_warnConnect(true),
|
||||
_haveServerPassword(false),
|
||||
_codePage(65001), // default to UTF8
|
||||
_originalCodePage(-1) {
|
||||
_originalCodePage(UINT16_MAX) {
|
||||
setOptional(true);
|
||||
requiresElevatedPrivileges(false);
|
||||
startsAfter("GreetingsPhase");
|
||||
|
@ -311,14 +311,17 @@ std::vector<std::string> ClientFeature::httpEndpoints() {
|
|||
void ClientFeature::start() {
|
||||
#if _WIN32
|
||||
_originalCodePage = GetConsoleOutputCP();
|
||||
|
||||
SetConsoleOutputCP(_codePage);
|
||||
if (IsValidCodePage(_codePage)) {
|
||||
SetConsoleOutputCP(_codePage);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ClientFeature::stop() {
|
||||
#if _WIN32
|
||||
SetConsoleOutputCP(_originalCodePage);
|
||||
if (IsValidCodePage(_originalCodePage)) {
|
||||
SetConsoleOutputCP(_originalCodePage);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,9 @@ void* LanguageFeature::prepareIcu(std::string const& binaryPath,
|
|||
std::string& path,
|
||||
std::string const& binaryName) {
|
||||
std::string fn("icudtl.dat");
|
||||
TRI_GETENV("ICU_DATA", path);
|
||||
if (TRI_GETENV("ICU_DATA", path)) {
|
||||
path = FileUtils::buildFilename(path, fn);
|
||||
}
|
||||
if (path.empty() || !TRI_IsRegularFile(path.c_str())) {
|
||||
if (!path.empty()) {
|
||||
LOG_TOPIC(WARN, arangodb::Logger::FIXME)
|
||||
|
|
Loading…
Reference in New Issue