Changing the file names from run.sh/run.bat to runsanity.sh/runsanity.bat to make...
[controller.git] / opendaylight / distribution / sanitytest / src / main / java / org / opendaylight / controller / distribution / Sanity.java
index 378ea8a..7fc25e2 100644 (file)
@@ -1,10 +1,12 @@
 package org.opendaylight.controller.distribution;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class Sanity {
 
     static void copy(InputStream in, OutputStream out) throws IOException {
@@ -20,20 +22,19 @@ public class Sanity {
 
         System.out.println("Current working directory = " + cwd);
 
-        // We assume that the program is being run from the sanitytest directory
-        // We need to specify the opendaylight directory as the working directory for the shell/batch scripts
-        File processWorkingDir = new File(cwd, "../opendaylight");
-
         String os = System.getProperty("os.name").toLowerCase();
-        String script = "./run.sh";
+        List<String> script = new ArrayList<String>();
 
         if(os.contains("windows")){
-            script = "run.bat";
+            script.add("cmd.exe");
+            script.add("/c");
+            script.add("runsanity.bat");
+        } else {
+            script.add("./runsanity.sh");
         }
 
         ProcessBuilder processBuilder = new ProcessBuilder();
-        processBuilder.directory(processWorkingDir.getCanonicalFile());
-        processBuilder.command(script);
+        processBuilder.inheritIO().command(script);
         Process p = processBuilder.start();
 
         copy(p.getInputStream(), System.out);