public interface Process
Please see the user manual for more detailed usage information.
Modifier and Type | Method and Description |
---|---|
static ProcessBuilder |
create(io.vertx.core.Vertx vertx,
String command)
Create a child process (not running) from this process, call
ProcessBuilder.start() to start the process. |
static ProcessBuilder |
create(io.vertx.core.Vertx vertx,
String command,
List<String> args)
Create a child process (not running) from this process, call
ProcessBuilder.start() to start the process. |
static ProcessBuilder |
create(io.vertx.core.Vertx vertx,
String command,
List<String> args,
ProcessOptions options)
Create a child process (not running) from this process, call
ProcessBuilder.start() to start the process. |
static ProcessBuilder |
create(io.vertx.core.Vertx vertx,
String command,
ProcessOptions options)
Create a child process (not running) from this process, call
ProcessBuilder.start() to start the process. |
static Map<String,String> |
env() |
Process |
exitHandler(io.vertx.core.Handler<Integer> handler)
Set the handler to be called when the process exits, the handler will be called with the
process status code value.
|
boolean |
isRunning()
Tests whether or not the process is still running or has exited.
|
default void |
kill()
Terminates the process in a graceful manner.
|
void |
kill(boolean force)
Terminates the process.
|
Integer |
pid() |
StreamInput |
stderr() |
StreamOutput |
stdin() |
StreamInput |
stdout() |
static ProcessBuilder create(io.vertx.core.Vertx vertx, String command)
ProcessBuilder.start()
to start the process.vertx
- the vertx instancecommand
- the command to runstatic ProcessBuilder create(io.vertx.core.Vertx vertx, String command, List<String> args)
ProcessBuilder.start()
to start the process.vertx
- the vertx instancecommand
- the command to runargs
- list of string argumentsstatic ProcessBuilder create(io.vertx.core.Vertx vertx, String command, ProcessOptions options)
ProcessBuilder.start()
to start the process.vertx
- the vertx instancecommand
- the command to runoptions
- the options to run the commandstatic ProcessBuilder create(io.vertx.core.Vertx vertx, String command, List<String> args, ProcessOptions options)
ProcessBuilder.start()
to start the process.vertx
- the vertx instancecommand
- the command to runargs
- list of string argumentsoptions
- the options to run the commandProcess exitHandler(io.vertx.core.Handler<Integer> handler)
handler
- the handlerInteger pid()
StreamOutput stdin()
StreamInput stdout()
StreamInput stderr()
default void kill()
On a POSIX OS, it sends the SIGTERM
.
void kill(boolean force)
If force
is false
, the process will be terminated gracefully (i.e. its shutdown logic will
be allowed to execute), assuming the OS supports such behavior. Note that the process may not actually
terminate, as its cleanup logic may fail or it may choose to ignore the termination request. If a guarantee
of termination is required, call this method with force equal to true instead.
If force
is true
, the process is guaranteed to terminate, but whether it is terminated
gracefully or not is OS-dependent. Note that it may take the OS a moment to terminate the process, so
isRunning()
may return true
for a brief period after calling this method.
On a POSIX OS, it sends the SIGTERM
or SIGKILL
signals.
force
- if true is passed, the process will be forcibly killedboolean isRunning()
Copyright © 2023 Eclipse. All rights reserved.