public abstract class LocalCommandLauncher extends Object implements CommandLauncher<ProcessAdapter>
| 构造器和说明 |
|---|
LocalCommandLauncher() |
| 限定符和类型 | 方法和说明 |
|---|---|
ProcessAdapter |
exec(CommandLine cmd,
Map<String,String> env)
Launches the given command in a new process.
|
abstract ProcessAdapter |
exec(CommandLine cmd,
Map<String,String> env,
File workingDir)
Launches the given command in a new process, in the given working
directory.
|
boolean |
isFailure(int exitValue)
Checks whether
exitValue signals a failure on the current
system (OS specific). |
public ProcessAdapter exec(CommandLine cmd, Map<String,String> env) throws IOException
CommandLauncherexec 在接口中 CommandLauncher<ProcessAdapter>cmd - The command to executeenv - The environment for the new process. If null, the environment
of the current process is used.IOException - if attempting to run a command in a specific directorypublic abstract ProcessAdapter exec(CommandLine cmd, Map<String,String> env, File workingDir) throws IOException
CommandLauncherexec 在接口中 CommandLauncher<ProcessAdapter>cmd - The command to executeenv - The environment for the new process. If null, the environment
of the current process is used.workingDir - The directory to start the command in. If null, the current
directory is usedIOException - if trying to change directorypublic boolean isFailure(int exitValue)
CommandLauncherexitValue signals a failure on the current
system (OS specific).
Note that this method relies on the conventions of the OS, it will return false results if the application you are running doesn't follow these conventions. One notable exception is the Java VM provided by HP for OpenVMS - it will return 0 if successful (like on any other platform), but this signals a failure on OpenVMS. So if you execute a new Java VM on OpenVMS, you cannot trust this method.
isFailure 在接口中 CommandLauncher<ProcessAdapter>exitValue - the exit value (return code) to be checkedtrue if exitValue signals a failureCommandLauncher.isFailure(int)Copyright © 2022. All rights reserved.