           out
           (init-throw err))))))
 
-(defn sh-wrapper-spit [dir env cmd stdin]
+(defn sh-wrapper-stdin [dir env cmd stdin]
   (sh/with-sh-dir dir
     (sh/with-sh-env (merge {:PATH path-env} env)
       (let [{:keys [exit err]} (apply sh/sh (conj (parse-as-sh-cmd cmd)

                          (call-sql "create_new_table"
                                    table-name
                                    (str "gid serial primary key," column-string))
                          (sh-wrapper-spit folder-name
                                           {:PASSWORD "ceo"}
                                           (format-simple "psql -h localhost -U ceo -d ceo -c `\\copy ext_tables.%1(%2) FROM stdin`"
                                                          table-name (str/join "," headers))
                                           body)
                          (if (= "plots" type)
                            (call-sql "select_partial_table_by_name" table-name)
                            (call-sql "select_partial_sample_table_by_name" table-name))

          (when-not (= 0 exit)
            (init-throw err)))))))

(defn sh-wrapper-stdout [dir env cmd]
  (sh/with-sh-dir dir
    (sh/with-sh-env (merge {:PATH path-env} env)
      (let [{:keys [exit err out]} (apply sh/sh (parse-as-sh-cmd cmd))]
