cakoose.util.exec
Class Exec
java.lang.Object
cakoose.util.exec.Exec
public class Exec
- extends Object
This stuff works, but it's probably not very clean when things go wrong.
- Need to be more careful about handling InterruptedException and InterruptedIOException.
- Need to be more careful with the I/O relay threads.
|
Method Summary |
Map<String,String> |
environment()
|
Process |
launch()
|
static Exec.Handle |
launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
File workingDir,
List<String> command)
|
static Exec.Handle |
launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
File workingDir,
String... command)
|
static Exec.Handle |
launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
List<String> command)
|
static Exec.Handle |
launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
String... command)
|
static Process |
launch(File workingDir,
List<String> command)
|
static Process |
launch(File workingDir,
String... command)
|
static Process |
launch(List<String> command)
|
static Process |
launch(String... command)
|
static void |
relay(InputStream source,
OutputStream target)
|
static void |
relay(InputStream source,
OutputStream target,
int bufferSize)
|
void |
setRedirectErrorStream(boolean redirect)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EmptyInput
public static final Exec.InputGenerator EmptyInput
OutputDiscarder
public static final Exec.OutputConsumer OutputDiscarder
Exec
public Exec(File workingDir,
String... args)
Exec
public Exec(String... args)
Exec
public Exec(File workingDir,
List<String> args)
Exec
public Exec(List<String> args)
environment
public Map<String,String> environment()
launch
public Process launch()
throws IOException
- Throws:
IOException
setRedirectErrorStream
public void setRedirectErrorStream(boolean redirect)
launch
public static Process launch(File workingDir,
String... command)
throws IOException
- Throws:
IOException
launch
public static Process launch(String... command)
throws IOException
- Throws:
IOException
launch
public static Process launch(File workingDir,
List<String> command)
throws IOException
- Throws:
IOException
launch
public static Process launch(List<String> command)
throws IOException
- Throws:
IOException
launch
public static Exec.Handle launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
File workingDir,
String... command)
throws IOException
- Throws:
IOException
launch
public static Exec.Handle launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
String... command)
throws IOException
- Throws:
IOException
launch
public static Exec.Handle launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
File workingDir,
List<String> command)
throws IOException
- Throws:
IOException
launch
public static Exec.Handle launch(Exec.InputGenerator in,
Exec.OutputConsumer out,
Exec.OutputConsumer err,
List<String> command)
throws IOException
- Throws:
IOException
relay
public static void relay(InputStream source,
OutputStream target)
throws IOException
- Throws:
IOException
relay
public static void relay(InputStream source,
OutputStream target,
int bufferSize)
throws IOException
- Throws:
IOException