Command Line Execution Extension for bld
https://github.com/rife2/bld-exec
.github/workflows | ||
.idea | ||
.vscode | ||
config | ||
lib/bld | ||
src | ||
.gitignore | ||
bld | ||
bld.bat | ||
LICENSE.txt | ||
README.md |
bld Command Line Execution Extension
To install, please refer to the extensions documentation.
To execute a command at the command line, add the following to your build file:
@BuildCommand
public void startServer() throws Exception {
new ExecOperation()
.fromProject(this)
.command("./start.sh")
.execute();
}
Failure Modes
Use the fail
function to specify whether data returned to the standard streams and/or an abnormal exit value
constitute a failure.
@BuildCommand
public void startServer() throws Exception {
new ExecOperation()
.fromProject(this)
.command("cmd", "/c", "stop.bat")
.fail(ExecFail.STDERR)
.execute();
}
The following predefined values are available:
Name | Failure When |
---|---|
ExecFail.EXIT |
Exit value > 0 |
ExecFail.NORMAL |
Exit value > 0 or any data to the standard error stream (stderr) |
ExecFail.OUTPUT |
Any data to the standard output stream (stdout) or stderr. |
ExecFail.STDERR |
Any data to stderr. |
ExecFail.STDOUT |
Any data to stdout. |
ExecFail.ALL |
Any of the conditions above. |
ExecFail.NONE |
Never fails. |
ExecFail.NORMAL
is the default value.
Working Directory
You can also specify the working directory:
@BuildCommand
public void startServer() throws Exception {
new ExecOperation()
.fromProject(this)
.command("touch", "foo.txt")
.workDir("/tmp")
.execute();
}