peterk
peterk

Reputation: 5444

In ant exec task can one supress the \t[exec] prefix added to all output from the child process?

In ant when running a command with the exec task anything written to stdout or stderr in the child process has " [exec] " prepended to every line written to both the console and the log file. Is there a way to suppress this behavior or explicitly supply the prefix? (ie: to "" or maybe just an indent)

This is because an ant build run in an IDE the prefix scrambles the ability of the IDE to jump to source files by clicking on the output error messages from javac and other compilers

Upvotes: 1

Views: 591

Answers (2)

Ed Randall
Ed Randall

Reputation: 7580

In an interactive terminal on MacOS, I successfully sidestepped the Ant log-wrapping mechanism on the exec task by means of the /dev/stdout and /dev/stderr devices, as follows:

<exec executable="python" output="/dev/stdout" error="/dev/stderr">
    <arg line='myscript.py' />
</exec>

This will probably also work on Linux, though I havn't explicitly tested it.

On Windows it also works using output="con" error="con" (though in my case, tty codes from my script won't work in a Windows cmd terminal).

Upvotes: 0

Oleg Pavliv
Oleg Pavliv

Reputation: 21172

You may run ant with -emacs option.

However in this case it will suppress the prefix for all tasks.

Otherwise you may implement your own log handler.

Upvotes: 3

Related Questions