technomancy / grenchman

Sorry about the name
GNU General Public License v3.0
217 stars 8 forks source link

Exit code on exceptions #38

Open metametadata opened 7 years ago

metametadata commented 7 years ago

I suppose the project is no longer actively developed but I'd like to submit the idea, just in case.

For scripting (e.g. on CI server) it would be great to be able to get exit error codes on evaluation exceptions. At the moment it looks like grench always returns 0:

ᐅ grench eval '(throw (ex-info "oops" {}))'
clojure.lang.ExceptionInfo: oops
 at clojure.core$ex_info.invokeStatic (core.clj:4725)
 ...

ᐅ echo $?                                                              
0
technomancy commented 7 years ago

Have you tried building from master? I believe this is fixed in 8ac000e8c26e390.

metametadata commented 7 years ago

No, I haven't. So I've just tried to do it under MacOS but the compilation failed:

ᐅ ocamlbuild -use-ocamlfind -lflags -cclib,-lreadline grench.native
+ ocamlfind ocamlc -c -g -annot -thread -package core -package async -package ctypes.foreign -o nrepl.cmo nrepl.ml
File "nrepl.ml", line 1, characters 5-14:
Warning 3: deprecated: module Async.Std
[since 2017-02] use Async. The Std sub-module is no longer needed
File "nrepl.ml", line 2, characters 5-13:
Warning 3: deprecated: module Core.Std
[since 2017-02] Use Core. The Std sub-module is no longer needed
File "nrepl.ml", line 11, characters 21-61:
Warning 3: deprecated: module Core.Std
[since 2017-02] Use Core. The Std sub-module is no longer needed
File "nrepl.ml", line 76, characters 6-13:
Error: This pattern matches values of type 'a option
       but a pattern was expected which matches values of type
         equal:(string -> string -> bool) -> string option
Command exited with code 2.
Compilation unsuccessful after building 7 targets (0 cached) in 00:00:00.

I don't have experience with OCaml, so I'm not sure if I did all the preparations correctly. Should I try to build it under another OS maybe? Also are there any plans for releasing the new version?

technomancy commented 7 years ago

I don't have experience with OCaml, so I'm not sure if I did all the preparations correctly. Should I try to build it under another OS maybe? Also are there any plans for releasing the new version?

I don't know how to do it on OS X unfortunately, but the instructions in the readme should work with Debian. I've got it compiling under OCaml 4.04.

At one point I was hoping to add tab completion, but I don't think realistically that will happen any time soon. I could do a release soon if I get some confirmation that things currently on master are working smoothly.

metametadata commented 7 years ago

Thank you for a quick reply. I too used 4.04.0. But I'll try to do it in Debian then.