git-hulk commented on code in PR #1037:
URL:
https://github.com/apache/incubator-kvrocks/pull/1037#discussion_r1003365512
##########
src/config/config.cc:
##########
@@ -657,30 +661,40 @@ Status Config::finish() {
return Status::OK();
}
-Status Config::Load(const std::string &path) {
- if (!path.empty()) {
- path_ = path;
- std::ifstream file(path_);
- if (!file.is_open()) return Status(Status::NotOK, strerror(errno));
+Status Config::Load(const CLIOptions &opts) {
+ if (!opts.conf_file.empty()) {
+ std::ifstream file;
+ std::istream *in = nullptr;
+ if (opts.conf_file == "-") {
+ in = &std::cin;
+ } else {
+ path_ = opts.conf_file;
+ file.open(path_);
Review Comment:
iostream will close the file after exiting the scope, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]