test/java/lang/ProcessBuilder/DestroyTest.java

Print this page
rev 8725 : 8024854: Basic changes and files to build the class library on AIX
Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, thomas.stuefe@sap.com
Reviewed-by: alanb, prr, sla, chegar, michaelm, mullan


 137     public void runTest() throws Exception {
 138         killProc(true).waitFor();
 139     }
 140 }
 141 
 142 public class DestroyTest {
 143 
 144     public static ProcessTest getTest() throws Exception {
 145         String osName = System.getProperty("os.name");
 146         if (osName.startsWith("Windows")) {
 147             return new WindowsTest();
 148         } else if (osName.startsWith("Linux") == true) {
 149             return new UnixTest(
 150                 File.createTempFile("ProcessTrap-", ".sh",null));
 151         } else if (osName.startsWith("Mac OS")) {
 152             return new MacTest(
 153                 File.createTempFile("ProcessTrap-", ".sh",null));
 154         } else if (osName.equals("SunOS")) {
 155             return new UnixTest(
 156                 File.createTempFile("ProcessTrap-", ".sh",null));



 157         }
 158         return null;
 159     }
 160 
 161     public static void main(String args[]) throws Exception {
 162         ProcessTest test = getTest();
 163         if (test == null) {
 164             throw new RuntimeException("Unrecognised OS");
 165         } else {
 166             new Thread(test).start();
 167             Thread.sleep(1000);
 168             test.runTest();
 169         }
 170     }
 171 }
 172 


 137     public void runTest() throws Exception {
 138         killProc(true).waitFor();
 139     }
 140 }
 141 
 142 public class DestroyTest {
 143 
 144     public static ProcessTest getTest() throws Exception {
 145         String osName = System.getProperty("os.name");
 146         if (osName.startsWith("Windows")) {
 147             return new WindowsTest();
 148         } else if (osName.startsWith("Linux") == true) {
 149             return new UnixTest(
 150                 File.createTempFile("ProcessTrap-", ".sh",null));
 151         } else if (osName.startsWith("Mac OS")) {
 152             return new MacTest(
 153                 File.createTempFile("ProcessTrap-", ".sh",null));
 154         } else if (osName.equals("SunOS")) {
 155             return new UnixTest(
 156                 File.createTempFile("ProcessTrap-", ".sh",null));
 157         } else if (osName.equals("AIX")) {
 158             return new UnixTest(
 159                 File.createTempFile("ProcessTrap-", ".sh",null));
 160         }
 161         return null;
 162     }
 163 
 164     public static void main(String args[]) throws Exception {
 165         ProcessTest test = getTest();
 166         if (test == null) {
 167             throw new RuntimeException("Unrecognised OS");
 168         } else {
 169             new Thread(test).start();
 170             Thread.sleep(1000);
 171             test.runTest();
 172         }
 173     }
 174 }
 175