nixj14
asked on
Stdout/Stderr of a Process
I want to access the ouput of a command executed within a Process. The command that I'm looking to capture the output from is:
cmd /c cd /d D:\eclipse\workspace\ANT && cvs -d :pserver:deployer@mitnick. ugs.com:/c vs commit -m warfile D:\eclipse\workspace\ANT/c vsworking/ CSS/Resour ces/Log4j. xml
Basically, I'm extending the ANT CVS task so that I can parse the result and find out what the new version number of the file is.
Heres a code snippet:
{
if (project != null) {
project.log("Execute:Comma ndLauncher : " +
Commandline.toString(cmd), Project.MSG_DEBUG);
}
return Runtime.getRuntime().exec( cmd, env);
}
cmd /c cd /d D:\eclipse\workspace\ANT && cvs -d :pserver:deployer@mitnick.
Basically, I'm extending the ANT CVS task so that I can parse the result and find out what the new version number of the file is.
Heres a code snippet:
{
if (project != null) {
project.log("Execute:Comma
Commandline.toString(cmd),
}
return Runtime.getRuntime().exec(
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I apologize that it took so long for me to get back to this, but its been project deployment week. This response is definitely what I needed. Have you thought about submitting this Substitute task to Apache?
Process p = Runtime.getRuntime().exec(
InputStream in = p.getInputStream();
the InputStream in is the output (Stdout) of the process.