From f8e901c9e311a6d9bae7bd032d2956451dc21446 Mon Sep 17 00:00:00 2001 From: Doodle <13706157+critical27@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:06:27 +0800 Subject: [PATCH] fix hdfs download command will always return succeeded --- src/common/hdfs/HdfsCommandHelper.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/common/hdfs/HdfsCommandHelper.cpp b/src/common/hdfs/HdfsCommandHelper.cpp index 14e6b7f98b8..117d3ffb6af 100644 --- a/src/common/hdfs/HdfsCommandHelper.cpp +++ b/src/common/hdfs/HdfsCommandHelper.cpp @@ -24,6 +24,9 @@ Status HdfsCommandHelper::ls(const std::string& hdfsHost, auto result = proc.wait(); if (!result.exited()) { return Status::Error("Failed to ls hdfs"); + } else if (result.exitStatus() != 0) { + LOG(INFO) << "Failed to ls: " << result.str(); + return Status::Error("Failed to ls hdfs, errno: %d", result.exitStatus()); } else { return Status::OK(); } @@ -47,6 +50,9 @@ Status HdfsCommandHelper::copyToLocal(const std::string& hdfsHost, auto result = proc.wait(); if (!result.exited()) { return Status::Error("Failed to download from hdfs"); + } else if (result.exitStatus() != 0) { + LOG(INFO) << "Failed to download: " << result.str(); + return Status::Error("Failed to download from hdfs, errno: %d", result.exitStatus()); } else { return Status::OK(); }