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 int exitValue ()
34 throw new IllegalThreadStateException ("Process has not exited");
39 public InputStream
getErrorStream ()
44 public InputStream
getInputStream ()
49 public OutputStream
getOutputStream ()
54 public native int waitFor () throws InterruptedException
;
56 public ConcreteProcess (String
[] progarray
,
61 for (int i
= 0; i
< progarray
.length
; i
++)
63 String s
= progarray
[i
];
65 if ( (s
.indexOf (' ') >= 0) || (s
.indexOf ('\t') >= 0))
66 progarray
[i
] = "\"" + s
+ "\"";
69 startProcess (progarray
, envp
, dir
);
72 // The standard streams (stdin, stdout and stderr, respectively)
73 // of the child as seen by the parent process.
74 private OutputStream outputStream
;
75 private InputStream inputStream
;
76 private InputStream errorStream
;
78 // Handle to the child process - cast to HANDLE before use.
79 private int procHandle
;
81 // Exit code of the child if it has exited.
84 private native boolean hasExited ();
85 private native void startProcess (String
[] progarray
,
89 private native void cleanup ();