You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henryk Konsek (JIRA)" <ji...@apache.org> on 2011/01/11 12:53:46 UTC

[jira] Commented: (EXEC-50) Pumping lines from the command output

    [ https://issues.apache.org/jira/browse/EXEC-50?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12980070#action_12980070 ] 

Henryk Konsek commented on EXEC-50:
-----------------------------------

And how was the review? :)

> Pumping lines from the command output
> -------------------------------------
>
>                 Key: EXEC-50
>                 URL: https://issues.apache.org/jira/browse/EXEC-50
>             Project: Commons Exec
>          Issue Type: Improvement
>    Affects Versions: 1.1
>            Reporter: Henryk Konsek
>            Assignee: Siegfried Goeschl
>            Priority: Trivial
>             Fix For: 1.2
>
>         Attachments: commons-exec.zip, lines_listener.patch
>
>
> My application makes heavy use of analyzing output lines of the long running executable. Executed command may run even up to to few hours. Actually I'm not so interested in the result of execution, but rather in the output produced by the program. Each line of the output contains some important data. I need to listen to these lines of the output, filter them and send JMS message containing selected of them.
> Current implementation of the StreamPumper makes it hard to listen to the output lines produced by the executable since it copies entire InputStream. What I did is pumping command output to the FilterInputStream and looking for the new line markers. It works for me, however it would be nice to have an ability to read entire lines from the PumpStream instead of raw bytes only. This is quite common case since executable usually format their output using the lines instead of the raw stream of bytes.
> I created patch refactoring StreamPumper to extend AbstractStreamPumper. I created also BufferedReaderPumper (also extending AbstractStreamPumper) to pump lines from the executable output and send them to the OutputLinesListener. I also extracted creation of the StreamPumper in the PumpStreamHandler to the factory method. This method can be overridden in order to use BufferedReaderPumper instead of default StreamPumper.
> What do you think about such approach?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.