You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ot...@apache.org on 2021/03/24 16:27:09 UTC
[nifi] branch main updated: NIFI-8354 ExecuteStreamCommand processor doesn't delete the temp file… (#4923)
This is an automated email from the ASF dual-hosted git repository.
otto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 0f28702 NIFI-8354 ExecuteStreamCommand processor doesn't delete the temp file… (#4923)
0f28702 is described below
commit 0f28702b475e5cf00ccb5b7e01b68119e645ad7d
Author: Hsin-Ying Lee <s9...@gmail.com>
AuthorDate: Thu Mar 25 00:26:56 2021 +0800
NIFI-8354 ExecuteStreamCommand processor doesn't delete the temp file… (#4923)
* NIFI-8354 ExecuteStreamCommand processor doesn't delete the temp file if the process start failed
* NIFI-8354 Record the log when delete file failed
This closes #4923
Signed-off-by: Otto Fowler <ot...@apache.org>
---
.../org/apache/nifi/processors/standard/ExecuteStreamCommand.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
index 4a68301..97b39bb 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
@@ -471,6 +471,13 @@ public class ExecuteStreamCommand extends AbstractProcessor {
try {
process = builder.start();
} catch (IOException e) {
+ try {
+ if (!errorOut.delete()) {
+ logger.warn("Unable to delete file: " + errorOut.getAbsolutePath());
+ }
+ } catch (SecurityException se) {
+ logger.warn("Unable to delete file: '" + errorOut.getAbsolutePath() + "' due to " + se);
+ }
logger.error("Could not create external process to run command", e);
throw new ProcessException(e);
}