1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-05 22:53:13 +02:00
David Inglis 2005-11-16 01:53:51 +00:00
parent 04d776da10
commit 7e52da1b5f

View file

@ -112,6 +112,8 @@ public class Spawner extends Process {
* See java.lang.Process#getInputStream (); * See java.lang.Process#getInputStream ();
**/ **/
public InputStream getInputStream() { public InputStream getInputStream() {
if(null == in)
in = new SpawnerInputStream(fChannels[1]);
return in; return in;
} }
@ -119,6 +121,8 @@ public class Spawner extends Process {
* See java.lang.Process#getOutputStream (); * See java.lang.Process#getOutputStream ();
**/ **/
public OutputStream getOutputStream() { public OutputStream getOutputStream() {
if(null == out)
out = new SpawnerOutputStream(fChannels[0]);
return out; return out;
} }
@ -126,6 +130,8 @@ public class Spawner extends Process {
* See java.lang.Process#getErrorStream (); * See java.lang.Process#getErrorStream ();
**/ **/
public InputStream getErrorStream() { public InputStream getErrorStream() {
if(null == err)
err = new SpawnerInputStream(fChannels[2]);
return err; return err;
} }
@ -136,12 +142,6 @@ public class Spawner extends Process {
while (!isDone) { while (!isDone) {
wait(); wait();
} }
try {
((SpawnerInputStream)getErrorStream()).close();
((SpawnerInputStream)getInputStream()).close();
((SpawnerOutputStream)getOutputStream()).close();
} catch (IOException e) {
}
return status; return status;
} }
@ -163,9 +163,12 @@ public class Spawner extends Process {
terminate(); terminate();
// Close the streams on this side. // Close the streams on this side.
try { try {
((SpawnerInputStream)getErrorStream()).close(); if(null == err)
((SpawnerInputStream)getInputStream()).close(); ((SpawnerInputStream)getErrorStream()).close();
((SpawnerOutputStream)getOutputStream()).close(); if(null == in)
((SpawnerInputStream)getInputStream()).close();
if(null == out)
((SpawnerOutputStream)getOutputStream()).close();
} catch (IOException e) { } catch (IOException e) {
} }
// Grace before using the heavy gone. // Grace before using the heavy gone.
@ -229,9 +232,6 @@ public class Spawner extends Process {
if (pid == -1) { if (pid == -1) {
throw new IOException("Exec error:" + reaper.getErrorMessage()); //$NON-NLS-1$ throw new IOException("Exec error:" + reaper.getErrorMessage()); //$NON-NLS-1$
} }
in = new SpawnerInputStream(fChannels[1]);
err = new SpawnerInputStream(fChannels[2]);
out = new SpawnerOutputStream(fChannels[0]);
} }
private void exec_pty(String[] cmdarray, String[] envp, String dirpath, PTY pty) throws IOException { private void exec_pty(String[] cmdarray, String[] envp, String dirpath, PTY pty) throws IOException {
@ -270,9 +270,6 @@ public class Spawner extends Process {
if (pid == -1) { if (pid == -1) {
throw new IOException("Exec_tty error:" + reaper.getErrorMessage()); //$NON-NLS-1$ throw new IOException("Exec_tty error:" + reaper.getErrorMessage()); //$NON-NLS-1$
} }
in = new SpawnerInputStream(fChannels[1]);
err = new SpawnerInputStream(fChannels[2]);
out = new SpawnerOutputStream(fChannels[0]);
} }
public void exec_detached(String[] cmdarray, String[] envp, String dirpath) throws IOException { public void exec_detached(String[] cmdarray, String[] envp, String dirpath) throws IOException {