ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Capturing the output of a ClearCase command from Exec
Date Thu, 15 Jan 2004 07:24:54 GMT
Let me see what happens on <exec>

1) Which class implements <exec>
oata/taskdefs/default.properties:
exec=org.apache.tools.ant.taskdefs.ExecTask

2) What happens there (simplified)?
    private Redirector redirector = new Redirector(this);

    public void setOutput(File out) {
        redirector.setOutput(out); 
    }

    public void execute() throws BuildException {
        runExec(prepareExec());
    }

    protected Execute prepareExec() throws BuildException {
        Execute exe = new Execute(createHandler(), createWatchdog());
    }

    protected ExecuteStreamHandler createHandler() throws BuildException {
        return redirector.createHandler();
    }


Personally I had never used the Redirector, but maybe that helps a little...


Jan



> -----Original Message-----
> From: sean.egan@cm-logic.com [mailto:sean.egan@cm-logic.com]
> Sent: Wednesday, January 14, 2004 5:11 PM
> To: dev@ant.apache.org
> Subject: RE: Capturing the output of a ClearCase command from Exec
> 
> 
> Hi,
> 
> The only place I can find this method is in the 'Exec' package which
> according to the documentation I shouldn't use anymore.
> The ClearCase package uses the 'Execute' package. Is there a way
> using this package to get it to give me the output, or do I have to
> use 'Exec'?
> 
> Thanks, Sean.
> 
> Original Message:
> -----------------
> From:  Jan.Materne@rzf.fin-nrw.de
> Date: Wed, 14 Jan 2004 16:22:49 +0100
> To: dev@ant.apache.org
> Subject: RE: Capturing the output of a ClearCase command from Exec
> 
> Hint: The <exec> task supports "output" for saving the output 
> to a file. So
> there must be an
> setOutput(...)
> 
> Jan
> 
> > -----Original Message-----
> > From: sean.egan@cm-logic.com [mailto:sean.egan@cm-logic.com]
> > Sent: Wednesday, January 14, 2004 4:19 PM
> > To: dev@ant.apache.org
> > Subject: Capturing the output of a ClearCase command from Exec
> > 
> > 
> > Hi,
> > 
> > I'm trying to extent some ClearCase packages.
> > I'm trying to store the output from an 'lsco' command using the
> > ClearCase 'run' method, which in turn uses Execute.
> > 
> > -------------------
> > protected int run(Commandline cmd) {
> >         try {
> >             Project aProj = getProject();
> >             Execute exe
> >                 = new Execute(new LogStreamHandler(this, 
> > Project.MSG_INFO,
> > Project.MSG_WARN));
> >             exe.setAntRun(aProj);
> >             exe.setWorkingDirectory(aProj.getBaseDir());
> >             exe.setCommandline(cmd.getCommandline());
> >             return exe.execute();
> >         } catch (java.io.IOException e) {
> >             throw new BuildException(e, getLocation());
> >         }
> >     }
> > -------------
> > 
> > I want to add another method (run_s) to save the actual output from
> > the command and not just the return code.
> > 
> > Can anyone help me?
> > 
> > Thanks, Sean.
> 
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message