Skip to content

Commit 5109f4c

Browse files
dmarkhasrnorth
authored andcommitted
updated docs with exitCode (#1319)
1 parent 50db30a commit 5109f4c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docs/examples/src/test/java/generic/ExecTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public void testSimpleExec() throws IOException, InterruptedException {
2424
// execReadingStdout {
2525
Container.ExecResult lsResult = container.execInContainer("ls", "-al", "/");
2626
String stdout = lsResult.getStdout();
27+
int exitCode = lsResult.getExitCode();
2728
assertTrue(stdout.contains("somefile.txt"));
29+
assertTrue(exitCode == 0);
2830
// }
2931
}
3032
}

docs/features/commands.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ Your test can execute a command inside a running container, similar to a `docker
1616
[Executing a command inside a running container](../examples/src/test/java/generic/ExecTest.java) inside_block:standaloneExec
1717
<!--/codeinclude-->
1818

19-
This can be useful for software that has a command line administration tool. You can also get the output (stdout/stderr) from the command - for example:
19+
This can be useful for software that has a command line administration tool. You can also get the output (stdout/stderr) and exit code from the command - for example:
2020

2121
<!--codeinclude-->
2222
[Executing a command inside a running container and reading the result](../examples/src/test/java/generic/ExecTest.java) inside_block:execReadingStdout
2323
<!--/codeinclude-->
2424

25-
Note that there is no way to get the return code of the executed command, only stdout/stderr.
26-
2725
## Environment variables
2826

2927
To add environment variables to the container, use `withEnv`:

0 commit comments

Comments
 (0)