< prev index next >

test/jdk/java/lang/ProcessBuilder/DestroyTest.java

Print this page
rev 59105 : imported patch corelibs


  96     public WindowsTest() throws IOException {
  97         bldr = new ProcessBuilder("ftp");
  98         bldr.redirectErrorStream(true);
  99         bldr.directory(new File("."));
 100         p = bldr.start();
 101     }
 102 
 103 }
 104 
 105 public class DestroyTest {
 106 
 107     public static ProcessTest getTest() throws Exception {
 108         String osName = System.getProperty("os.name");
 109         if (osName.startsWith("Windows")) {
 110             return new WindowsTest();
 111         } else {
 112             File userDir = new File(System.getProperty("user.dir", "."));
 113             File tempFile = File.createTempFile("ProcessTrap-", ".sh", userDir);
 114             if (osName.startsWith("Linux")
 115                     || osName.startsWith("Mac OS")
 116                     || osName.equals("SunOS")
 117                     || osName.equals("AIX")) {
 118                 return new UnixTest(tempFile);
 119             }
 120         }
 121         return null;
 122     }
 123 
 124     public static void main(String args[]) throws Exception {
 125         ProcessTest test = getTest();
 126         if (test == null) {
 127             throw new RuntimeException("Unrecognised OS");
 128         } else {
 129             new Thread(test).start();
 130             Thread.sleep(1000);
 131             test.runTest();
 132         }
 133     }
 134 }
 135 


  96     public WindowsTest() throws IOException {
  97         bldr = new ProcessBuilder("ftp");
  98         bldr.redirectErrorStream(true);
  99         bldr.directory(new File("."));
 100         p = bldr.start();
 101     }
 102 
 103 }
 104 
 105 public class DestroyTest {
 106 
 107     public static ProcessTest getTest() throws Exception {
 108         String osName = System.getProperty("os.name");
 109         if (osName.startsWith("Windows")) {
 110             return new WindowsTest();
 111         } else {
 112             File userDir = new File(System.getProperty("user.dir", "."));
 113             File tempFile = File.createTempFile("ProcessTrap-", ".sh", userDir);
 114             if (osName.startsWith("Linux")
 115                     || osName.startsWith("Mac OS")

 116                     || osName.equals("AIX")) {
 117                 return new UnixTest(tempFile);
 118             }
 119         }
 120         return null;
 121     }
 122 
 123     public static void main(String args[]) throws Exception {
 124         ProcessTest test = getTest();
 125         if (test == null) {
 126             throw new RuntimeException("Unrecognised OS");
 127         } else {
 128             new Thread(test).start();
 129             Thread.sleep(1000);
 130             test.runTest();
 131         }
 132     }
 133 }
 134 
< prev index next >