Package eu.simuline.m2latex.core
Class CommandExecutor
- java.lang.Object
-
- eu.simuline.m2latex.core.CommandExecutor
-
-
Field Summary
Fields Modifier and Type Field Description private LogWrapperlog
-
Constructor Summary
Constructors Constructor Description CommandExecutor(LogWrapper log)
-
Method Summary
Modifier and Type Method Description private Stringexecute(File workingDir, File pathToExecutable, String command, String[] args)Executecommandwith argumentsargsin the working directoryworkingDir.(package private) Stringexecute(File workingDir, File pathToExecutable, String command, String[] args, File... resFile)Logging: EEX01: return code other than 0.private booleanisUpdatedOrWarn(String command, File target, boolean existedBefore, long lastModifiedBefore)
-
-
-
Field Detail
-
log
private final LogWrapper log
-
-
Constructor Detail
-
CommandExecutor
CommandExecutor(LogWrapper log)
-
-
Method Detail
-
execute
String execute(File workingDir, File pathToExecutable, String command, String[] args, File... resFile) throws BuildFailureException
Logging:- EEX01: return code other than 0.
- EEX02: no target file
- EEX03: target file not updated
- WEX04: cannot read target file
- WEX05: may emit false warnings
- Parameters:
workingDir- the working directory. The shell changes to that directory before invokingcommandwith argumentsargs.pathToExecutable- the path to the executablecommand. This may benullifcommandis on the execution pathcommand- the name of the program to be executedargs- the list of arguments, each containing a blank enclosed in double quotes.resFile- result files, i.e. target files which shall be updated bu this command.- Throws:
BuildFailureException
-
isUpdatedOrWarn
private boolean isUpdatedOrWarn(String command, File target, boolean existedBefore, long lastModifiedBefore)
- Parameters:
command- the name of the program to be executed Logging:- EEX02: no target file
- EEX03: target file not updated
- WEX04: cannot read target file
-
execute
private String execute(File workingDir, File pathToExecutable, String command, String[] args) throws BuildFailureException
Executecommandwith argumentsargsin the working directoryworkingDir. Here,pathToExecutableis the path to the executable. May be null?Logging: EEX01 for return code other than 0.
- Parameters:
workingDir- the working directory. The shell changes to that directory before invokingcommandwith argumentsargs.pathToExecutable- the path to the executablecommand. This may benullifcommandis on the execution pathcommand- the name of the program to be executedargs- the list of arguments, each containing a blank enclosed in double quotes.- Throws:
BuildFailureException- TEX01 if invocation ofcommandfails very basically:- the file expected to be the working directory does not exist or is not a directory.
-
Runtime.exec(String, String[], File)fails throwing anIOException. - an error inside systemOut parser occurs
- an error inside systemErr parser occurs
- Wrapping an
InterruptedExceptionon the process to be executed thrown byProcess.waitFor().
-
-