Skip to content

Instantly share code, notes, and snippets.

@jakemcc
Created February 27, 2019 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakemcc/e0853fd42fb59f6c202f879cc493c365 to your computer and use it in GitHub Desktop.
Save jakemcc/e0853fd42fb59f6c202f879cc493c365 to your computer and use it in GitHub Desktop.
weird.clj
qqq.core> (require '[clojure.java.shell :as shell])
nil
;; Kick off a future that is reading System/in and just print the result
qqq.core> (future
(println (.read System/in))
(println "done"))
#<Future@536d8f5e: :pending>
;; Invoke something that uses /bin/sh, see the output
qqq.core> (shell/sh "/bin/sh" "-c" "echo yolo")
{:exit 0, :out "yolo\n", :err ""}
;; Use /bin/bash, notice output from (.read System/in) returning -1 and future finishing
qqq.core> (shell/sh "/bin/bash" "-c" "echo yolo")
-1
done
{:exit 0, :out "yolo\n", :err ""}
;; Any ideas what is going on?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment