Maybe there should be an 'Expect' language type task created. Has Expect
been ported to Java?
Josef.
----- Original Message -----
From: Brian M. Kelley <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 13, 2000 7:55 PM
Subject: cvs task - BufferedReader code in Exec.java
> Hey all. I apologize if this is a huge letter, but I need all the space
> to specify our problem. In using the cvs task in our build.xml, I've ran
> into a curious annoyance, having to do with the cvs login command. So,
we
> have in our build file something like:
>
> <!-- Slurp the native link/runtime libraries and headers from the CVS
> repository on poe; login first. -->
> <cvs
> cvsRoot=":pserver:[EMAIL PROTECTED]:/usr/local/projects/share/cvs"
> command="login"
> />
> ...
>
>
> Upon ant's execution of the cvs login command, we get:
>
>
> [Cvs] (Logging in to [EMAIL PROTECTED])
>
>
> and we sit and wait for an eternity, _hoping_ to see:
>
>
> [Cvs] CVS Password:
>
>
> but we never do, until we hit carriage-return. I traced this back
> to some code in org.apache.tools.ant.taskdefs.Exec :
>
>
> public void pumpStream()
> throws IOException
> {
> byte[] buf = new byte[BUFFER_SIZE];
> if (!endOfStream) {
> String line = din.readLine();
>
> if (line != null) {
> outputLog(line, messageLevel);
> } else {
> endOfStream = true;
> }
> }
> }
>
> The deal is that 'cvs login', with a CVSROOT that points to a pserver,
> (i.e. CVSROOT=:pserver:[EMAIL PROTECTED]:/mycvs/dir) does an 'interactive'
login,
> one that prompts for a password with the string:
>
> CVS Password:
>
> with _no_ newline. Thus, when the output stream of the process that is
> executing the cvs command is 'pumped' (i.e., the code fragment above
> is ran through), din.readLine() is hoping to read a string that ends
with
> a newline or carriage-return linefeed (which the cvs interactive login
> prompt does not contain). Thus, we don't see the interactive prompt
> until we hit our carriage-return (thus not inputting a password for
> cvs to validate us, making 'cvs login' fail). Of course, we could just
> realize that we don't have to wait for the password prompt, type in
> our password, hit enter, and go on our merry way. This doesn't seem
> to be the best behavior for a cvs login, though.
>
> Any workarounds (I've tried a few with no success)? Will there be a fix
> for this? Am I completely off base? I read in the code that jCVS might
be
> used in the future; How far away from that point are we now?
>
> I apologize if this subject has come up before and I wasn't around to
> hear about it. :)
>
>
> Brian
>