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 <s9514...@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 <o...@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); }