Added opton to add a List via the command method

This commit is contained in:
Erik C. Thauvin 2023-08-27 16:46:47 -07:00
parent 9843cfeb6b
commit 193c791408
6 changed files with 44 additions and 8 deletions

View file

@ -29,9 +29,15 @@ constitute a failure.
```java
@BuildCommand
public void startServer() throws Exception {
final List<String> cmds;
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
cmds = List.of("cmd", "/c", "stop.bat");
} else {
cmds = List.of("./stop.sh");
}
new ExecOperation()
.fromProject(this)
.command("cmd", "/c", "stop.bat")
.command(cmds)
.fail(ExecFail.STDERR)
.execute();
}
@ -61,7 +67,7 @@ public void startServer() throws Exception {
new ExecOperation()
.fromProject(this)
.command("touch", "foo.txt")
.workDir("/tmp")
.workDir(System.getProperty("java.io.tmpdir"))
.execute();
}
```