ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Sunde" <msu...@actional.com>
Subject Interacting/killing process created from exec
Date Fri, 25 Jun 2004 15:03:07 GMT
Hi,
 
I am creating a process using the exec task and redirecting the output
to a file. Since ant created the Process object and is holding onto the
input and output streams for the process, is there a way of sending
stuff to the input stream of the processes (maybe using the echo task)?
Specifically, I am trying to send a CTRL-C to the process to cause it to
exit.
 
<exec dir="${root}/bin" executable="cmd.exe"
output="${output.dir}/output.txt">
            <arg value="/c"/>
            <arg value="mystart.bat"/>
</exec>
 
 
Background:
-------------------------------
>From within ant, I am running a few sanity tests on my program.
Everything is working except the shutdown when something goes wrong.
Normally I can gracefully shutdown the process, but occasionally this
doesn't work and I have to kill or send CTRL-C to the process to cause
it to exit. I was hoping that ant would kill the process tree, but this
does not appear to be working (probably a limitation of os or java).
When I look at the process tree, I see:
-          java (for ant)
o        cmd.exe (mystart.bat)
*         myprogram.exe
 
When ant exits due to an exception, I see that the cmd.exe process is
killed and then ant hangs. The process tree now looks like:
-          java (for ant)
-          myprogram.exe
 
Ant seems to be waiting for the output stream to be closed. If I
manually kill myprogram.exe, then ant terminates. I thought of removing
mystart.bat, but it is needed to set up the environment for the program
and must also be tested. I need the output of the program redirected to
a file so that it can be analyzed later (when something goes wrong).
 
Any suggestions on how I can kill myprogram.exe?
What about interacting with the process using the input stream?
 
Thanks,
Michael

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