Fix typo in the last changelog entry.
[official-gcc.git] / libjava / testsuite / libjava.lang / Process_1.java
blobadc6354660d1c0a25844a1591ef0c244d24c07cc
1 // Create a process and read from its standard output.
2 //
3 import java.io.BufferedReader;
4 import java.io.InputStream;
5 import java.io.InputStreamReader;
8 public class Process_1
10 public static void main(String[] args)
12 try
14 Runtime r = Runtime.getRuntime();
15 String s = "Hello World";
16 String[] a = { "echo", s };
17 Process p = r.exec(a);
18 InputStream is = p.getInputStream();
19 InputStreamReader isr = new InputStreamReader(is);
20 BufferedReader br = new BufferedReader(isr);
21 String result = br.readLine();
22 if (! s.equals(result))
24 System.out.println("bad 1");
25 return;
27 result = br.readLine();
28 if (result != null)
30 System.out.println("bad 2");
31 return;
33 int c = p.waitFor();
34 System.out.println(c == 0 ? "ok" : "bad 3");
36 catch (Exception ex)
38 System.out.println(ex.toString());