Interface Process
-
public interface ProcessA process launched from this current process.Please see the user manual for more detailed usage information.
- Author:
- Julien Viet
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static ProcessBuildercreate(Vertx vertx, String command)Create a child process (not running) from this process, callProcessBuilder.start()to start the process.static ProcessBuildercreate(Vertx vertx, String command, ProcessOptions options)Create a child process (not running) from this process, callProcessBuilder.start()to start the process.static ProcessBuildercreate(Vertx vertx, String command, List<String> args)Create a child process (not running) from this process, callProcessBuilder.start()to start the process.static ProcessBuildercreate(Vertx vertx, String command, List<String> args, ProcessOptions options)Create a child process (not running) from this process, callProcessBuilder.start()to start the process.static Map<String,String>env()ProcessexitHandler(Handler<Integer> handler)Set the handler to be called when the process exits, the handler will be called with the process status code value.booleanisRunning()Tests whether or not the process is still running or has exited.default voidkill()Terminates the process in a graceful manner.voidkill(boolean force)Terminates the process.Integerpid()StreamInputstderr()StreamOutputstdin()StreamInputstdout()
-
-
-
Method Detail
-
create
static ProcessBuilder create(Vertx vertx, String command)
Create a child process (not running) from this process, callProcessBuilder.start()to start the process.- Parameters:
vertx- the vertx instancecommand- the command to run- Returns:
- the created child process
-
create
static ProcessBuilder create(Vertx vertx, String command, List<String> args)
Create a child process (not running) from this process, callProcessBuilder.start()to start the process.- Parameters:
vertx- the vertx instancecommand- the command to runargs- list of string arguments- Returns:
- the created child process
-
create
static ProcessBuilder create(Vertx vertx, String command, ProcessOptions options)
Create a child process (not running) from this process, callProcessBuilder.start()to start the process.- Parameters:
vertx- the vertx instancecommand- the command to runoptions- the options to run the command- Returns:
- the created child process
-
create
static ProcessBuilder create(Vertx vertx, String command, List<String> args, ProcessOptions options)
Create a child process (not running) from this process, callProcessBuilder.start()to start the process.- Parameters:
vertx- the vertx instancecommand- the command to runargs- list of string argumentsoptions- the options to run the command- Returns:
- the created child process
-
exitHandler
Process exitHandler(Handler<Integer> handler)
Set the handler to be called when the process exits, the handler will be called with the process status code value.- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
pid
Integer pid()
- Returns:
- the process PID or null if the process is not running
-
stdin
StreamOutput stdin()
- Returns:
- the process stdin stream
-
stdout
StreamInput stdout()
- Returns:
- the process stdout stream
-
stderr
StreamInput stderr()
- Returns:
- the process stderr stream
-
kill
default void kill()
Terminates the process in a graceful manner.On a POSIX OS, it sends the
SIGTERM.
-
kill
void kill(boolean force)
Terminates the process.If
forceisfalse, 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
forceistrue, 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, soisRunning()may returntruefor a brief period after calling this method.On a POSIX OS, it sends the
SIGTERMorSIGKILLsignals.- Parameters:
force- if true is passed, the process will be forcibly killed
-
isRunning
boolean isRunning()
Tests whether or not the process is still running or has exited.
-
-