l3nz / cli-matic

Compact, hands-free [sub]command line parsing library for Clojure.
Eclipse Public License 2.0
361 stars 29 forks source link

Errors should use std-err #100

Closed phillord closed 4 years ago

phillord commented 4 years ago

version

0.3.11

platform

OpenJDK1.8 and 1.11

problem

cli-matic uses std-out for error messages when it should use std-err. This is the normal behaviour of clojure with unhandled errors, but cli-matic capture these and re-prints them with ** ERROR: ** at the top. This is just expected and has broken my command line testing which previous to the use of cli-matic used stderr for errors.

repro

(ns proj.core
  (:require [cli-matic.core :refer [run-cmd]])
  (:gen-class))

(defn break [& args]
  (throw (Exception. "I am broken")))

(def CONFIGURATION
  {:commands [{:command "break"
                :runs break}]})

(defn -main [& args]
  ;(throw (Exception. "Normal Breakage"))
  (run-cmd args CONFIGURATION))
lein run break 2> /dev/null

expected behavior

I should see nothing (or alternatively with lein run break > /dev/null I should see an error message).

actual behavior

I get the error message.

l3nz commented 4 years ago

Makes sense, especially in context with #102 that would still go to stdout.