You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/01/23 19:13:36 UTC

svn commit: r902451 - /maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/Utils.java

Author: bentmann
Date: Sat Jan 23 18:13:36 2010
New Revision: 902451

URL: http://svn.apache.org/viewvc?rev=902451&view=rev
Log:
o Fixed IT to properly consume process output

Modified:
    maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/Utils.java

Modified: maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/Utils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/Utils.java?rev=902451&r1=902450&r2=902451&view=diff
==============================================================================
--- maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/Utils.java (original)
+++ maven/plugins/trunk/maven-clean-plugin/src/test/java/org/apache/maven/plugin/clean/Utils.java Sat Jan 23 18:13:36 2010
@@ -21,6 +21,10 @@
 
 import java.io.File;
 
+import org.codehaus.plexus.util.cli.CommandLineUtils;
+import org.codehaus.plexus.util.cli.Commandline;
+import org.codehaus.plexus.util.cli.StreamConsumer;
+
 /**
  * Testing helpers for the IT scripts.
  * 
@@ -40,10 +44,25 @@
     {
         try
         {
-            String[] args = { "ln", "-s", target.getAbsolutePath(), link.getAbsolutePath() };
-            Process process = Runtime.getRuntime().exec( args );
-            process.waitFor();
-            return 0 == process.exitValue();
+            Commandline cli = new Commandline();
+            cli.setExecutable( "ln" );
+            cli.createArg().setValue( "-s" );
+            cli.createArg().setFile( target );
+            cli.createArg().setFile( link );
+            int code = CommandLineUtils.executeCommandLine( cli, new StreamConsumer()
+            {
+                public void consumeLine( String line )
+                {
+                    System.out.println( line );
+                }
+            }, new StreamConsumer()
+            {
+                public void consumeLine( String line )
+                {
+                    System.err.println( line );
+                }
+            } );
+            return 0 == code;
         }
         catch ( Exception e )
         {