1 // Win32Process.java - Subclass of Process for Win32 systems.
3 /* Copyright (C) 2002, 2003, 2006 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 final class Win32Process
extends Process
27 public native void destroy ();
29 public int exitValue ()
32 throw new IllegalThreadStateException ("Process has not exited");
37 public InputStream
getErrorStream ()
42 public InputStream
getInputStream ()
47 public OutputStream
getOutputStream ()
52 public native int waitFor () throws InterruptedException
;
54 public Win32Process (String
[] progarray
,
59 for (int i
= 0; i
< progarray
.length
; i
++)
61 String s
= progarray
[i
];
63 if ( (s
.indexOf (' ') >= 0) || (s
.indexOf ('\t') >= 0))
64 progarray
[i
] = "\"" + s
+ "\"";
67 startProcess (progarray
, envp
, dir
);
70 // The standard streams (stdin, stdout and stderr, respectively)
71 // of the child as seen by the parent process.
72 private OutputStream outputStream
;
73 private InputStream inputStream
;
74 private InputStream errorStream
;
76 // Handle to the child process - cast to HANDLE before use.
77 private int procHandle
;
79 // Exit code of the child if it has exited.
82 private native boolean hasExited ();
83 private native void startProcess (String
[] progarray
,
87 private native void cleanup ();