Github user nsanglar commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2594#discussion_r187841413
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
---
@@ -382,10 +389,10 @@ public void onTrigger(ProcessContext context, final
ProcessSession session) thro
Map<String, String> attributes = new HashMap<>();
final StringBuilder strBldr = new StringBuilder();
- try {
- String line;
- while ((line = bufferedReader.readLine()) != null) {
- strBldr.append(line).append("\n");
+ try (final InputStream is = new FileInputStream(errorOut)) {
--- End diff --
Strange, the link is not working for me either anymore. There are some
pointers on this stackoverflow thread:
https://stackoverflow.com/questions/16983372/why-does-process-hang-if-the-parent-does-not-consume-stdout-stderr-in-java
The difference is that by writing to a file, you bypass the OS pipe for
stderr, and therefore it does not block.
By the way if you execute `TestExecuteStreamCommand` with the old code, you
will be able to reproduce the deadlock even with unit tests.
---