diff --git a/src/dorkbox/executor/JvmExecutor.java b/src/dorkbox/executor/JvmExecutor.java index afec468..8269149 100644 --- a/src/dorkbox/executor/JvmExecutor.java +++ b/src/dorkbox/executor/JvmExecutor.java @@ -104,11 +104,11 @@ class JvmExecutor extends ShellExecutor { private List jvmOptions = new ArrayList(); private List classpathEntries = new ArrayList(); - // what version of java?? - // so, this starts a NEW java, from an ALREADY existing java. private List mainClassArguments = new ArrayList(); private String jarFile; + // what version of java?? + // so, this starts a NEW JVM, from an ALREADY existing JVM. public JvmExecutor() { super(null, null, null); @@ -140,7 +140,7 @@ class JvmExecutor extends ShellExecutor { } public final - void addJvmClasspaths(List paths) { + void addJvmClasspath(List paths) { this.classpathEntries.addAll(paths); } diff --git a/src/dorkbox/executor/ShellExecutor.java b/src/dorkbox/executor/ShellExecutor.java index 844e7dd..b369b3d 100644 --- a/src/dorkbox/executor/ShellExecutor.java +++ b/src/dorkbox/executor/ShellExecutor.java @@ -40,7 +40,8 @@ import java.util.Map; public class ShellExecutor { - // TODO: Add the ability to get the process PID via java for mac/windows/linux. Linux is avail from jvm, windows needs JNA + // TODO: Add the ability to get the process PID via java for mac/windows/linux. Linux is avail from jvm, windows needs JNA, mac ??? + // of important note, the pid needs to be gotten "on demand", as linux can change the pid if it wants to static final String LINE_SEPARATOR = System.getProperty("line.separator"); static final boolean isWindows; @@ -68,9 +69,9 @@ class ShellExecutor { private Process process = null; - private ProcessProxy writeToProcess_input = null; - private ProcessProxy readFromProcess_output = null; - private ProcessProxy readFromProcess_error = null; + private ProcessStreamProxy writeToProcess_input = null; + private ProcessStreamProxy readFromProcess_output = null; + private ProcessStreamProxy readFromProcess_error = null; private boolean createReadWriterThreads = false; @@ -261,7 +262,7 @@ class ShellExecutor { } /** - * @return the executable command issued to the shell + * @return the executable command issued */ public String getCommand() { @@ -462,9 +463,9 @@ class ShellExecutor { // readers (read process -> write console) // have to keep the output buffers from filling in the target process. - readFromProcess_output = new ProcessProxy("Process Reader: " + this.executableName, - this.process.getInputStream(), - nullOutputStream); + readFromProcess_output = new ProcessStreamProxy("Process Reader: " + this.executableName, + this.process.getInputStream(), + nullOutputStream); } } // we want to pipe our input/output from process to ourselves @@ -474,14 +475,14 @@ class ShellExecutor { * to the user's window. This is important or the spawned process could block. */ // readers (read process -> write console) - readFromProcess_output = new ProcessProxy("Process Reader: " + this.executableName, - this.process.getInputStream(), - this.outputStream); + readFromProcess_output = new ProcessStreamProxy("Process Reader: " + this.executableName, + this.process.getInputStream(), + this.outputStream); if (this.outputErrorStream != this.outputStream) { - readFromProcess_error = new ProcessProxy("Process Reader: " + this.executableName, - this.process.getErrorStream(), - this.outputErrorStream); + readFromProcess_error = new ProcessStreamProxy("Process Reader: " + this.executableName, + this.process.getErrorStream(), + this.outputErrorStream); } } @@ -490,9 +491,9 @@ class ShellExecutor { * Proxy System.in from the user's window to the spawned process */ // writer (read console -> write process) - writeToProcess_input = new ProcessProxy("Process Writer: " + this.executableName, - this.inputStream, - this.process.getOutputStream()); + writeToProcess_input = new ProcessStreamProxy("Process Writer: " + this.executableName, + this.inputStream, + this.process.getOutputStream()); } diff --git a/src/dorkbox/executor/TeeOutputStream.java b/src/dorkbox/executor/TeeOutputStream.java deleted file mode 100644 index 665d39a..0000000 --- a/src/dorkbox/executor/TeeOutputStream.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2010 dorkbox, llc - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package dorkbox.executor; - -import java.io.IOException; -import java.io.OutputStream; - -public -class TeeOutputStream extends OutputStream { - private final OutputStream out; - private final OutputStream tee; - - public - TeeOutputStream(OutputStream out, OutputStream tee) { - if (out == null) { - throw new NullPointerException(); - } - else if (tee == null) { - throw new NullPointerException(); - } - else { - this.out = out; - this.tee = tee; - } - } - - @Override - public - void write(int b) throws IOException { - this.out.write(b); - this.tee.write(b); - } - - @Override - public - void write(byte[] b) throws IOException { - this.out.write(b); - this.tee.write(b); - } - - @Override - public - void write(byte[] b, int off, int len) throws IOException { - this.out.write(b, off, len); - this.tee.write(b, off, len); - } - - @Override - public - void flush() throws IOException { - this.out.flush(); - this.tee.flush(); - } - - @Override - public - void close() throws IOException { - this.out.close(); - this.tee.close(); - } -}