test/java/lang/Runtime/exec/LotsOfDestroys.java

Print this page

        

*** 24,47 **** /** * @test * @bug 4637504 4653814 * @summary Destroy should close stderr, stdout and stdin * @author kladko */ - import java.io.File; - public class LotsOfDestroys { static final int RUNS = 400; - static final String ECHO = "/usr/bin/echo"; public static void main(String[] args) throws Exception { ! if (File.separatorChar == '\\' || // Windows ! !new File(ECHO).exists()) // no echo return; ! for (int i = 0; i<= RUNS; i++) { ! Process process = Runtime.getRuntime().exec(ECHO + " x"); process.destroy(); } } } --- 24,45 ---- /** * @test * @bug 4637504 4653814 * @summary Destroy should close stderr, stdout and stdin * @author kladko + * @run main/othervm LotsOfDestroys */ public class LotsOfDestroys { static final int RUNS = 400; public static void main(String[] args) throws Exception { ! if (System.getProperty("os.name").startsWith("Windows")) { ! System.err.println("Not for Windows"); return; ! } for (int i = 0; i<= RUNS; i++) { ! Process process = Runtime.getRuntime().exec(UnixCommands.echo() + " x"); process.destroy(); } } }