                             (.-value (.-target e))))
        :value @command
        :placeholder "type in shell command"}]]]
-   [:pre @shell-result]])
+   [:pre (join-lines (take 100 (reverse (split-lines @shell-result))))]])
 
 (reagent/render
   [root-component]

(ns ui.core
  (:require [figwheel.client :as fw :include-macros true]
            [reagent.core :as reagent :refer [atom]]
            [clojure.string :as string]))

(enable-console-print!)



(defonce proc (js/require "child_process"))

(defn append-to-out [out]
  (swap! shell-result str out))

(defn run-process []
  (let [[cmd & args] (string/split @command #"\s")
        p (.spawn proc cmd (clj->js args))]
    (.on p "error" (comp append-to-out
                         #(str % "\n")))
    (.on (.-stderr p) "data" append-to-out)
    (.on (.-stdout p) "data" append-to-out))
  (reset! command ""))

(defn root-component []
