Top Description Fields Constructors Methods
org.eclipse.jgit.internal.diffmergetool

public Class CommandExecutor

extends Object
Class Inheritance
Imports
java.io.File, .FileOutputStream, .IOException, .OutputStream, java.nio.file.Files, .Path, .Paths, java.util.Arrays, .Map, org.eclipse.jgit.errors.NoWorkTreeException, org.eclipse.jgit.util.FS, .FS.ExecutionResult, .FS_POSIX, .FS_Win32, .FS_Win32_Cygwin, .StringUtils, .SystemReader

Runs a command with help of FS.

Field Summary

Modifier and TypeField and Description
private boolean
private File
private FS
private boolean

Constructor Summary

AccessConstructor and Description
public
CommandExecutor(FS
the file system
fs
,
boolean
should the exit code be checked for errors ?
checkExitCode
)

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

the execution result
checkExecutable
(String
the executable path
path
,
File
the working directory
workingDir
,
Map<String, String>
the environment
env
)

Check whether executable file is available

private void
private String[]
private void
private void
private void
private boolean
public FS.ExecutionResult

Returns:

the execution result
run
(String
the command string
command
,
File
the working directory
workingDir
,
Map<String, String>
the environment
env
)

Run command

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checkExitCodeback to summary
private boolean checkExitCode
commandFileback to summary
private File commandFile
fsback to summary
private FS fs
useMsys2back to summary
private boolean useMsys2

Constructor Detail

CommandExecutorback to summary
public CommandExecutor(FS fs, boolean checkExitCode)
Parameters
fs:FS

the file system

checkExitCode:boolean

should the exit code be checked for errors ?

Method Detail

checkExecutableback to summary
public boolean checkExecutable(String path, File workingDir, Map<String, String> env) throws ToolException, IOException, InterruptedException

Check whether executable file is available

Parameters
path:String

the executable path

workingDir:File

the working directory

env:Map<String, String>

the environment

Returns:boolean

the execution result

Exceptions
ToolException:
if a tool raised an error
IOException:
if an IO error occurred
InterruptedException:
if thread was interrupted
checkUseMsys2back to summary
private void checkUseMsys2(String command)
createCommandArrayback to summary
private String[] createCommandArray(String command) throws ToolException, IOException
createCommandFileback to summary
private void createCommandFile(String command) throws ToolException, IOException
deleteCommandArrayback to summary
private void deleteCommandArray()
deleteCommandFileback to summary
private void deleteCommandFile()
isCommandExecutionErrorback to summary
private boolean isCommandExecutionError(int rc)
runback to summary
public FS.ExecutionResult run(String command, File workingDir, Map<String, String> env) throws ToolException, IOException, InterruptedException

Run command

Parameters
command:String

the command string

workingDir:File

the working directory

env:Map<String, String>

the environment

Returns:FS.ExecutionResult

the execution result

Exceptions
ToolException:
if a tool raised an error
IOException:
if an IO error occurred
InterruptedException:
if thread was interrupted