ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Reentry problems with CVS task (mabye Execute task used by composition)
Date Sat, 17 Aug 2002 00:16:05 GMT

I am writting a task which makes use of a utility with the following
method.  The basic idea is that a CVS object is configured with a
PumpStreamHandler (implements the ExecuteStreamHandler interface) created
with PipedInputOutputStream and PipedOutputStream instances.  A later
method wraps
the PipedInputStream instance returned by the createCvsLogStream method in
a BufferedReader and proceeds to read the results of the cvs log command.
When the method with the BufferedReader is done it calls the close method
on both the BufferedReader and the PipedInputStream instances.

This works fine on the first pass, but on the second pass hangs indefintely
at the cvs.execute() command.  If one walks down deeply into the
execute method, one finds the hanging occurs when the Java13CommandLauncher
inner class of calls the line:
_execWithCWD.invoke(Runtime.getRuntime(), arguments);

If one inspects the Java13CommandLauncher class variables one finds:
_execWithCWD = Runtime.class.getMethod("exec",
                new Class[] {String[].class, String[].class, File.class});

Unfortunately, I don't know enough to understand why this is hanging.
Remember, that it is just fine on the first pass, but has problems on the
second.  I suspect I may be falling ito a common trap and don't recognize

Can anyone provide some guidance?

      private static PipedInputStream createCvsLogStream(
            Cvs cvs,
            String guideFile)
            throws BuildException {

            //Prepare an ExecuteStreamHandler for CVS
            PipedOutputStream pipedOS = new PipedOutputStream();
            PipedInputStream pipedIS;
            try {
                  pipedIS = new PipedInputStream(pipedOS);
            } catch (IOException ex) {
                  throw new BuildException("Encountered problems creating a
piped input stream.");

            ExecuteStreamHandler exeSH = new PumpStreamHandler(pipedOS);

            //Configure cvs
            cvs.setCommand("log " + guideFile);

            //Flush and close piped output stream
            try {
            } catch (IOException ex) {
                  throw new BuildException(
                        "Had problems flushing piped output stream "
                              + "used in CvsUtility.createCvsLogStream");
            try {
            } catch (IOException ex) {
                  throw new BuildException(
                        "Had problems closing piped output stream "
                              + "used in CvsUtility.createCvsLogStream");

            return pipedIS;

James Lee Carpenter
Software Engineer
Household Technical Services
6602 Convoy Court
San Diego, CA 92111

ph: 858-609-2461

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message