ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject [PATCH] logging for Execute class command launchers
Date Mon, 12 Feb 2001 18:56:52 GMT
Hello,

Attached is a patch to fix an annoying deficiency in the debug logging for
the <exec> task and other tasks that call the Execute class.  Currently,
there's no logging that will output the exact command being sent to
Runtime.exec().  Since the various Command Launcher classes take the
specified command and modify it in various ways, you don't really know
what's being passed to Runtime.exec().

This patch rectifies this issue by added a project.log call outputting the
command and it's arguments to the superclasses of the various Command
Launcher classes.  The result is you can see exactly what's being passed
to Runtime.exec() when the -debug option is specified.

Here are a couple of examples of the output first using the JDK 1.2.2 on
Win NT 4.0:

$ export JAVA_HOME=/d/jdk1.2.2
$ ant -f execdirtest.xml -debug -Dexec=dir -Ddir=g:\archives -Darg='*.bat'
...
Build sequence for target `main' is [main]
Complete build sequence is [main]

main:
     [exec] Myos = Windows NT
     [exec] dir *.bat
Execute:CommandLauncher: cmd /c cd G:\\archives && dir *.bat
     [exec]  Volume in drive D has no label.
     [exec]  Volume Serial Number is E8BD-8AE3
     [exec]
     [exec]  Directory of D:\Work\anttest
...

Now using the SDK 1.3.0 also on Win NT 4.0:

$ export JAVA_HOME=/d/jdk1.3
$ ant -f execdirtest.xml -debug -Dexec=lsdir.bat -Darg='*.bat'
...
Build sequence for target `main' is [main]
Complete build sequence is [main]

main:
     [exec] Myos = Windows NT
     [exec] lsdir.bat *.bat
Execute:Java13CommandLauncher: lsdir.bat *.bat
     [exec]
     [exec] D:\Work\anttest>dir  *.bat
     [exec]  Volume in drive D has no label.
     [exec]  Volume Serial Number is E8BD-8AE3
     [exec]
     [exec]  Directory of D:\Work\anttest
...

The Execute class doesn't have access to the task instance that called it
so it can't call task.log which would prefix the output with the "[exec]"
or whatever appropriate decoration for the current task.  For debugging
output, I don't think this is an issue.

It would be nice if this could go into 1.3.

Thanks,
-Bill Burton
Mime
View raw message