Initial commit
This commit is contained in:
commit
c230f7f979
28 changed files with 1040 additions and 0 deletions
72
README.md
Executable file
72
README.md
Executable file
|
@ -0,0 +1,72 @@
|
|||
# [b<span style="color:orange">l</span>d](https://rife2.com/bldb) Command Line Execution Extension
|
||||
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
|
||||
[](https://rife2.com/bld)
|
||||
[](https://repo.rife2.com/#/releases/com/uwyn/rife2/bld-exec)
|
||||
[](https://repo.rife2.com/#/snapshots/com/uwyn/rife2/bld-exec)
|
||||
[](https://github.com/rife2/bld-exec/actions/workflows/bld.yml)
|
||||
|
||||
To install, please refer to the [extensions documentation](https://github.com/rife2/bld/wiki/Extensions).
|
||||
|
||||
To execute a command at the command line, add the following to your build file:
|
||||
|
||||
```java
|
||||
@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.
|
||||
|
||||
```java
|
||||
@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:
|
||||
|
||||
```java
|
||||
@BuildCommand
|
||||
public void startServer() throws Exception {
|
||||
new ExecOperation()
|
||||
.fromProject(this)
|
||||
.command("touch", "foo.txt")
|
||||
.workDir("/tmp")
|
||||
.execute();
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue