clj-commons/clj-ssh

Out-stream doesn't seem to work?

halgari opened this issue · 1 comments

Example code:

(ns clj-ssh-test.core
    (:require [clj-ssh.cli :as ssh]))



(let [proc (ssh/ssh "localhost" "ls")]
   proc) ;; returns ls output in :out


(let [proc (ssh/ssh "localhost" "ls" :out :stream)]
  (println "start [" (slurp (:out-stream proc)) "]"))
    ;; Prints "start [ ]" ls response is not printed

I'm using Clojure 1.7.0-alpha1 and clj-ssh 0.5.10

I think the issue is that the returned stream is a PipedInputStream, which seems to have unusual behaviour. read returns -1 if available returns zero, and throws an IOException when the pipe is closed.