diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java index e0d199ea86372..c53ddc0725ca2 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java @@ -977,7 +977,9 @@ private void runCommand() throws IOException { builder.environment().clear(); } - builder.environment().putAll(this.environment); + if (!environment.isEmpty()) { + builder.environment().putAll(this.environment); + } if (dir != null) { builder.directory(this.dir);