clj-commons / clj-ssh

SSH commands via jsch
234 stars 66 forks source link

Out-stream doesn't seem to work? #29

Closed halgari closed 10 years ago

halgari commented 10 years ago

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

hugoduncan commented 10 years ago

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.