Skip to content

Commit 0817921

Browse files
committed
docs(README): update client.run() documentation for clarity on output handling
1 parent 1323d28 commit 0817921

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ void main() async {
179179
}
180180
```
181181

182-
> `client.run()` is a convenience method that wraps `client.execute()` for running non-interactive commands.
182+
> `client.run()` is a convenience method that returns combined output bytes.
183+
> Use `client.runWithResult()` when you need separate `stdout` / `stderr`
184+
> streams and command exit metadata (`exitCode` / `exitSignal`).
183185
184186
To also access command exit metadata:
185187

@@ -188,6 +190,7 @@ void main() async {
188190
final result = await client.runWithResult('echo hello');
189191
print('exitCode: ${result.exitCode}');
190192
print('stdout: ${utf8.decode(result.stdout)}');
193+
print('stderr: ${utf8.decode(result.stderr)}');
191194
}
192195
```
193196

lib/src/ssh_client.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ class SSHClient {
564564
/// This is a convenience method over [execute]. If [stdout] is false,
565565
/// the standard output of the command will be ignored. If [stderr] is
566566
/// false, the standard error of the command will be ignored.
567+
///
568+
/// Use [runWithResult] when you need separate stdout/stderr bytes or exit
569+
/// metadata (`exitCode`/`exitSignal`).
567570
Future<Uint8List> run(
568571
String command, {
569572
bool runInPty = false,

0 commit comments

Comments
 (0)