From 038e02d8d9d35d0734c1c522dec8a74d90486825 Mon Sep 17 00:00:00 2001 From: zitan <11285749+gg814@users.noreply.github.com> Date: Mon, 1 Jun 2020 12:13:36 -0700 Subject: [PATCH] Remove extraneous newline from ldb stderr (#6897) Summary: **Summary** Remove the extraneous newline when using ldb tool. For example, the subcommand list_column_families will print an empty line to stderr even if there are no errors. **Test plan** Passed make check; manually tested a few ldb subcommands. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6897 Reviewed By: pdillinger Differential Revision: D21819352 Pulled By: gg814 fbshipit-source-id: 5a16a6431bb96684fe97647f4d3ac5bf0ec7fc90 --- tools/ldb_tool.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/ldb_tool.cc b/tools/ldb_tool.cc index 80e71b35f..f9374955a 100644 --- a/tools/ldb_tool.cc +++ b/tools/ldb_tool.cc @@ -124,7 +124,9 @@ int LDBCommandRunner::RunCommand( cmdObj->Run(); LDBCommandExecuteResult ret = cmdObj->GetExecuteState(); - fprintf(stderr, "%s\n", ret.ToString().c_str()); + if (!ret.ToString().empty()) { + fprintf(stderr, "%s\n", ret.ToString().c_str()); + } delete cmdObj; return ret.IsFailed() ? 1 : 0;