Github user brosander commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1364#discussion_r101160112
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java
 ---
    @@ -342,16 +393,45 @@ public void onTrigger(ProcessContext context, final 
ProcessSession session) thro
                     final InputStream pis = process.getInputStream();
                     final InputStream pes = process.getErrorStream();
                     final BufferedInputStream bis = new 
BufferedInputStream(pis);
    +                final BufferedInputStream bes = new 
BufferedInputStream(pes);
                     final BufferedReader bufferedReader = new 
BufferedReader(new InputStreamReader(pes))) {
                 int exitCode = -1;
                 final BufferedOutputStream bos = new BufferedOutputStream(pos);
    +            final StringBuilder strBldr = new StringBuilder();
                 FlowFile outputFlowFile = putToAttribute ? inputFlowFile : 
session.create(inputFlowFile);
    +            FlowFile errorFlowFile=null;
    +            FlowWriterThread flowWriter = null;
    +            if (REDIRECT_ERROR_ERROR_STREAM.equals(redirectErrorStream)) {
    +                 errorFlowFile = session.create(inputFlowFile);
    +                flowWriter = new FlowWriterThread(errorFlowFile, session, 
bes);
    +                this.executor.submit(flowWriter);
    +            }
    +            //if redirect error stream is set to log, then write the error 
to nifi component log.
    +            if (REDIRECT_ERROR_LOG.equals(redirectErrorStream)) {
    +                this.executor.submit(new Runnable() {
    +                    @Override
    +                    public void run() {
    +                       try (final BufferedReader reader = new 
BufferedReader(new InputStreamReader(pes))) {
    +                            String line;
    +                            while ((line = bufferedReader.readLine()) != 
null) {
    +                                 logger.warn("ExecuteStreamCommand 
:"+line);
    +                                 strBldr.append(line).append("\n");
    --- End diff --
    
    It looks like we're only going to use the first 4000 characters of strBldr, 
we might want to preemptively throw away anything before that so we don't have 
to store all the output in memory


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to