   (let [result-lines (string/split command-output #"\n")
         result-key (first result-lines)
         result-out (second result-lines)
-        status (int (read-string (nth result-lines 2)))]
+        status (int (read-string (last result-lines)))]
       {(keyword result-key) {:exit-code (if (zero? status) 1 0)
                              :stout result-out}}))
 


(def CommandFactResults {s/Keyword CommandFactResult})

(def output-separator "----- command output separator -----\n")

; -----------------------  functions  -------------------------------
(s/defn command-to-keyword :- s/Keyword


(s/defn collect-command-fact
  [fact-config :- CommandFactConfig]
  (print fact-config)
  (collect-fact
    fact-id-command
    (str
      (string/join
        "; " (map #(build-command-script %) fact-config)))
    :transform-fn parse-command-outputs))
