diff options
author | Kevin Pulo <kevin.pulo@mongodb.com> | 2018-01-04 06:34:45 +0000 |
---|---|---|
committer | Kevin Pulo <kevin.pulo@mongodb.com> | 2018-01-11 04:09:47 +0000 |
commit | 06002a6b47800a57dafdafad5e0343876f979b7b (patch) | |
tree | 286aa97a5ae68d676e1a79835bd5eb42895d44f9 /src | |
parent | eed88312a95e199f07826f4e8f48e5461c4bf900 (diff) | |
download | mongo-06002a6b47800a57dafdafad5e0343876f979b7b.tar.gz |
SERVER-32473 don't output an error on shell startup if no history file
(cherry picked from commit 4e51bb975ba8b1d2e5faa396543f16eff2ecdee5)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/shell/linenoise.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/shell/linenoise.cpp b/src/mongo/shell/linenoise.cpp index 352eb308750..5663e6accce 100644 --- a/src/mongo/shell/linenoise.cpp +++ b/src/mongo/shell/linenoise.cpp @@ -2815,6 +2815,11 @@ mongo::Status linenoiseHistorySave(const char* filename) { mongo::Status linenoiseHistoryLoad(const char* filename) { FILE* fp = fopen(filename, "rt"); if (fp == NULL) { + if (errno == ENOENT) { + // Not having a history file isn't an error condition. + // For example, it's always the case when the shell is run for the first time. + return mongo::Status::OK(); + } return linenoiseFileError(mongo::ErrorCodes::FileOpenFailed, "fopen()", filename); } |