summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.lang/Process_4.java
blob: 1511a74a6b2686cf28849b3d46718d6ccc0d3c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Create a process and verify failure exit code.
public class Process_4
{
  public static void main(String[] args)
  {
    try
      {
	Runtime r = Runtime.getRuntime();
	String[] a = { "false" };
	Process p = r.exec(a);
	int c = p.waitFor();
	// Solaris' false doesn't return 1.
	System.out.println(c != 0 ? "ok" : "bad");
      }
    catch (Exception ex)
      {
	System.out.println(ex.toString());
      }
  }
}