Skip to content

Commit 5654e50

Browse files
committed
Add text explaining that :cmd exec's a process without a shell
1 parent d912506 commit 5654e50

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ The `clj-ssh.ssh` namespace should be using SSH from functional code.
5959
(with-connection session
6060
(let [result (ssh session {:in "echo hello"})]
6161
(println (result :out)))
62-
(let [result (ssh session "/bin/bash" "-c" "ls" "/")]
62+
(let [result (ssh session {:cmd "ls"}]
6363
(println (second result))))))
6464
```
6565

66+
The above example shows using `:in` to pass commands to a shell, and using
67+
`:cmd` to exec a command without a shell. When using `:cmd` you can still pass
68+
a stream or a string to `:in` to be used as the process' standard input.
69+
6670
```clj
6771
(let [agent (ssh-agent {})]
6872
(let [session (session agent "localhost" {:strict-host-key-checking :no})]

0 commit comments

Comments
 (0)