Class RunProcess
- java.lang.Object
- org.springframework.boot.loader.tools.RunProcess
public class RunProcess extends Object
Utility used to run a process.- Since:
- 1.1.0
Constructor Summary
Constructors Constructor Description RunProcess(File workingDirectory, String... command)
Creates newRunProcess
instance for the specified working directory and command.RunProcess(String... command)
Creates newRunProcess
instance for the specified command.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Process
getRunningProcess()
Return the running process.boolean
handleSigInt()
Return if the process was stopped.boolean
hasJustEnded()
void
kill()
Kill this process.int
run(boolean waitForProcess, String... args)
protected int
run(boolean waitForProcess, Collection<String> args)
Constructor Detail
RunProcess
public RunProcess(String... command)
Creates newRunProcess
instance for the specified command.- Parameters:
command
- the program to execute and its arguments
RunProcess
public RunProcess(File workingDirectory, String... command)
Creates newRunProcess
instance for the specified working directory and command.- Parameters:
workingDirectory
- the working directory of the child process ornull
to run in the working directory of the current Java processcommand
- the program to execute and its arguments
Method Detail
run
public int run(boolean waitForProcess, String... args) throws IOException
- Throws:
IOException
run
protected int run(boolean waitForProcess, Collection<String> args) throws IOException
- Throws:
IOException
getRunningProcess
public Process getRunningProcess()
Return the running process.- Returns:
- the process or
null
handleSigInt
public boolean handleSigInt()
Return if the process was stopped.- Returns:
true
if stopped
kill
public void kill()
Kill this process.
hasJustEnded
public boolean hasJustEnded()