test/java/lang/Runtime/exec/ConcurrentRead.java

Print this page

        

*** 28,52 **** * @author kladko */ import java.io.InputStream; import java.io.OutputStream; - import java.io.File; - import java.io.IOException; public class ConcurrentRead { static volatile Exception savedException; - static final String TEE = "/usr/bin/tee"; public static void main(String[] args) throws Exception { ! ! if (File.separatorChar == '\\' || // Windows ! !new File(TEE).exists()) // no tee return; ! ! Process p = Runtime.getRuntime().exec(TEE); OutputStream out = p.getOutputStream(); InputStream in = p.getInputStream(); Thread t1 = new WriterThread(out, in); t1.start(); Thread t2 = new WriterThread(out, in); --- 28,48 ---- * @author kladko */ import java.io.InputStream; import java.io.OutputStream; public class ConcurrentRead { static volatile Exception savedException; public static void main(String[] args) throws Exception { ! if (System.getProperty("os.name").startsWith("Windows")) { ! System.err.println("Not for Windows"); return; ! } ! Process p = Runtime.getRuntime().exec(UnixCommands.tee()); OutputStream out = p.getOutputStream(); InputStream in = p.getInputStream(); Thread t1 = new WriterThread(out, in); t1.start(); Thread t2 = new WriterThread(out, in);