Skip to content

Commit e628034

Browse files
committed
execVerbose docs
1 parent 287c1ad commit e628034

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/features/containers.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,26 @@ const { output, exitCode } = await container.exec(["echo", "hello", "world"], {
537537
}
538538
});
539539
```
540+
To handle cases where you need separate outputs for `stdout` and `stderr`, you can use the `execVerbose` method.
541+
It functions similarly to `exec`, but provides detailed output including `stdout`, `stderr`, and `exitCode`.
542+
543+
```javascript
544+
const container = await new GenericContainer("alpine")
545+
.withCommand(["sleep", "infinity"])
546+
.start();
547+
548+
const { stdout, stderr, exitCode } = await container.execVerbose(["echo", "hello", "world"], {
549+
workingDir: "/app/src/",
550+
user: "1000:1000",
551+
env: {
552+
"VAR1": "enabled",
553+
"VAR2": "/app/debug.log",
554+
}
555+
});
556+
```
557+
Use `execVerbose` when you require more granular control over command outputs,
558+
while retaining similar options and functionality as `exec`.
559+
540560

541561
## Streaming logs
542562

0 commit comments

Comments
 (0)