From 45f0a2e3e25ec5fee27d111d342cebd6c677abfe Mon Sep 17 00:00:00 2001 From: Chris Badahdah Date: Tue, 18 Feb 2020 13:50:45 -0700 Subject: [PATCH] Removes whitespace insertion at the end of files --- src/node_cljfmt/main.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node_cljfmt/main.cljs b/src/node_cljfmt/main.cljs index 2a6c259..659db2b 100644 --- a/src/node_cljfmt/main.cljs +++ b/src/node_cljfmt/main.cljs @@ -33,15 +33,16 @@ (defn stdin-read [opts] (let [stdin (aget js/process "stdin") + stdout (aget js/process "stdout") content (atom "")] (.call (aget stdin "setEncoding") stdin "utf8") (.call (aget stdin "on") stdin "readable" (fn [] (if-let [s (.call (aget stdin "read") stdin)] (swap! content str s)))) (.call (aget stdin "on") stdin "end" (fn [] (try (let [formatted (cljfmt/reformat-string @content opts)] - (.log js/console formatted)) s + (.write stdout formatted)) s (catch :default e - (.log js/console @content) + (.write stdout @content) (.error js/console e))))))) (defn -main []