Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 82883 invoked from network); 21 Oct 2010 20:38:44 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Oct 2010 20:38:44 -0000 Received: (qmail 2226 invoked by uid 500); 21 Oct 2010 20:38:44 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 2147 invoked by uid 500); 21 Oct 2010 20:38:44 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 2116 invoked by uid 99); 21 Oct 2010 20:38:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Oct 2010 20:38:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Oct 2010 20:38:42 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9LKcKfv022508 for ; Thu, 21 Oct 2010 20:38:20 GMT Message-ID: <7277989.15861287693500865.JavaMail.jira@thor> Date: Thu, 21 Oct 2010 16:38:20 -0400 (EDT) From: "Henryk Konsek (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (EXEC-50) Pumping lines from the command output In-Reply-To: <13701656.15811287693498321.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/EXEC-50?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henryk Konsek updated EXEC-50: ------------------------------ Attachment: lines_listener.patch > Pumping lines from the command output > ------------------------------------- > > Key: EXEC-50 > URL: https://issues.apache.org/jira/browse/EXEC-50 > Project: Commons Exec > Issue Type: Improvement > Reporter: Henryk Konsek > Priority: Trivial > Attachments: 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.