mirror of https://gitee.com/bigwinds/arangodb
if we detect that we're running in a cygwin shell, assume we can use unix like message printing.
This commit is contained in:
parent
52783bd9fa
commit
93f7284851
|
@ -48,7 +48,9 @@ double const ArangoClient::DEFAULT_REQUEST_TIMEOUT = 300.0;
|
||||||
size_t const ArangoClient::DEFAULT_RETRIES = 2;
|
size_t const ArangoClient::DEFAULT_RETRIES = 2;
|
||||||
|
|
||||||
double const ArangoClient::LONG_TIMEOUT = 86400.0;
|
double const ArangoClient::LONG_TIMEOUT = 86400.0;
|
||||||
|
#ifdef _WIN32
|
||||||
|
bool cygwinShell = false;
|
||||||
|
#endif
|
||||||
namespace {
|
namespace {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool _newLine () {
|
bool _newLine () {
|
||||||
|
@ -564,24 +566,26 @@ void ArangoClient::_printLine (const string &s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArangoClient::printLine (const string& s, bool forceNewLine) {
|
void ArangoClient::printLine (const string& s, bool forceNewLine) {
|
||||||
#ifdef _WIN32
|
#if _WIN32
|
||||||
// no, we cannot use std::cout as this doesn't support UTF-8 on Windows
|
if (!cygwinShell) {
|
||||||
//fprintf(stdout, "%s\r\n", s.c_str());
|
// no, we cannot use std::cout as this doesn't support UTF-8 on Windows
|
||||||
TRI_vector_string_t subStrings = TRI_SplitString(s.c_str(), '\n');
|
//fprintf(stdout, "%s\r\n", s.c_str());
|
||||||
bool hasNewLines = (s.find("\n") != string::npos) | forceNewLine;
|
TRI_vector_string_t subStrings = TRI_SplitString(s.c_str(), '\n');
|
||||||
if (hasNewLines) {
|
bool hasNewLines = (s.find("\n") != string::npos) | forceNewLine;
|
||||||
for (size_t i = 0; i < subStrings._length; i++) {
|
if (hasNewLines) {
|
||||||
_printLine(subStrings._buffer[i]);
|
for (size_t i = 0; i < subStrings._length; i++) {
|
||||||
_newLine();
|
_printLine(subStrings._buffer[i]);
|
||||||
|
_newLine();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_printLine(s);
|
||||||
|
}
|
||||||
|
TRI_DestroyVectorString(&subStrings);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
_printLine(s);
|
|
||||||
}
|
|
||||||
TRI_DestroyVectorString(&subStrings);
|
|
||||||
#else
|
|
||||||
fprintf(stdout, "%s\n", s.c_str());
|
|
||||||
#endif
|
#endif
|
||||||
|
fprintf(stdout, "%s\n", s.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -2302,7 +2302,12 @@ int main (int argc, char* args[]) {
|
||||||
eRunMode runMode = eInteractive;
|
eRunMode runMode = eInteractive;
|
||||||
// reset the prompt error flag (will determine prompt colors)
|
// reset the prompt error flag (will determine prompt colors)
|
||||||
bool promptError = false;
|
bool promptError = false;
|
||||||
|
#if _WIN32
|
||||||
|
extern bool cygwinShell;
|
||||||
|
if (getenv("SHELL") != NULL) {
|
||||||
|
cygwinShell = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
arangoshEntryFunction();
|
arangoshEntryFunction();
|
||||||
|
|
||||||
TRIAGENS_C_INITIALISE(argc, args);
|
TRIAGENS_C_INITIALISE(argc, args);
|
||||||
|
|
Loading…
Reference in New Issue