1 // Win32Process.java - Subclass of Process for Win32 systems.
3 /* Copyright (C) 2002, 2003 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
14 import java
.io
.InputStream
;
15 import java
.io
.OutputStream
;
16 import java
.io
.IOException
;
23 // This is entirely internal to our implementation.
25 // This file is copied to `ConcreteProcess.java' before compilation.
26 // Hence the class name apparently does not match the file name.
27 final class ConcreteProcess
extends Process
29 public native void destroy ();
31 public native boolean hasExited ();
33 public int exitValue ()
36 throw new IllegalThreadStateException ("Process has not exited");
41 public InputStream
getErrorStream ()
46 public InputStream
getInputStream ()
51 public OutputStream
getOutputStream ()
56 public native int waitFor () throws InterruptedException
;
58 public native void startProcess (String
[] progarray
,
63 public native void cleanup ();
65 public ConcreteProcess (String
[] progarray
,
70 for (int i
= 0; i
< progarray
.length
; i
++)
72 String s
= progarray
[i
];
74 if ( (s
.indexOf (' ') >= 0) || (s
.indexOf ('\t') >= 0))
75 progarray
[i
] = "\"" + s
+ "\"";
78 startProcess (progarray
, envp
, dir
);
81 // The standard streams (stdin, stdout and stderr, respectively)
82 // of the child as seen by the parent process.
83 private OutputStream outputStream
;
84 private InputStream inputStream
;
85 private InputStream errorStream
;
87 // Handle to the child process - cast to HANDLE before use.
88 private int procHandle
;
90 // Exit code of the child if it has exited.