test/java/lang/Runtime/exec/ConcurrentRead.java
Print this page
@@ -28,25 +28,21 @@
* @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
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ System.err.println("Not for Windows");
return;
-
- Process p = Runtime.getRuntime().exec(TEE);
+ }
+ 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);