Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@apache.org Received: (qmail 79436 invoked from network); 1 Feb 2003 05:09:23 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 1 Feb 2003 05:09:23 -0000 Received: (qmail 22533 invoked by uid 97); 1 Feb 2003 05:10:59 -0000 Delivered-To: qmlist-jakarta-archive-ant-dev@nagoya.betaversion.org Received: (qmail 22526 invoked from network); 1 Feb 2003 05:10:59 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 1 Feb 2003 05:10:59 -0000 Received: (qmail 79067 invoked by uid 500); 1 Feb 2003 05:09:19 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 79056 invoked by uid 500); 1 Feb 2003 05:09:19 -0000 Received: (qmail 79053 invoked from network); 1 Feb 2003 05:09:19 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 1 Feb 2003 05:09:19 -0000 Received: (qmail 60509 invoked by uid 1142); 1 Feb 2003 05:09:17 -0000 Date: 1 Feb 2003 05:09:17 -0000 Message-ID: <20030201050917.60508.qmail@icarus.apache.org> From: conor@apache.org To: jakarta-ant-cvs@apache.org Subject: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce P4HandlerAdapter.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N conor 2003/01/31 21:09:17 Modified: src/main/org/apache/tools/ant/taskdefs/optional/perforce P4HandlerAdapter.java Log: Avoid perforce task lockup when only output on stderr PR: 16544 Submitted by: Antoine Levy-Lambert Revision Changes Path 1.8 +33 -13 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java Index: P4HandlerAdapter.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -u -r1.7 -r1.8 --- P4HandlerAdapter.java 30 Jul 2002 09:12:11 -0000 1.7 +++ P4HandlerAdapter.java 1 Feb 2003 05:09:17 -0000 1.8 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,18 +86,10 @@ } //Now read any input and process - - BufferedReader input = new BufferedReader( - new InputStreamReader( - new SequenceInputStream(is, es))); - - String line; - while ((line = input.readLine()) != null) { - process(line); - } - - input.close(); - + Thread output = new Thread(new Reader(is)); + Thread error = new Thread(new Reader(es)); + output.start(); + error.start(); } catch (Exception e) { throw new BuildException(e); @@ -122,4 +114,32 @@ public void stop() { } + public class Reader implements Runnable { + protected InputStream mystream; + public Reader(InputStream is) + { + mystream=is; + } + public void setStream(InputStream is) { + mystream=is; + } + public void run() { + BufferedReader input = new BufferedReader( + new InputStreamReader(mystream)); + + String line; + try { + while ((line = input.readLine()) != null) { + synchronized (this){ + process(line); + } + } } + catch (Exception e) { + throw new BuildException(e); + } + } + + } +} + --------------------------------------------------------------------- To unsubscribe, e-mail: ant-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: ant-dev-help@jakarta.apache.org