Thanks. I would not have thought to check that.

These are the processes running after launching each REPL.

$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0-beta4"}}}'

Does not include cause.

rlwrap -r -q \" -b (){}[],^%3@";:' clojure -Sdeps {:deps 
{org.clojure/clojure {:mvn/version "1.10.0-beta4"}}}

/usr/bin/java 
-Dclojure.libfile=/home/austin/.clojure/.cpcache/638968264.libs -classpath 
src:/home/austin/.m2/repository/org/clojure/clojure/1.10.0-beta4/clojure-1.10.0-beta4.jar:/home/austin/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar:/home/austin/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
 
clojure.main

$ lein repl

Includes cause.

java -Dfile.encoding=UTF-8 -Dmaven.wagon.http.ssl.easy=false 
-Dmaven.wagon.rto=10000 -Xverify:none -XX:+TieredCompilation 
-XX:TieredStopAtLevel=1 -Dleiningen.original.pwd=/home/austin 
-Dleiningen.script=/home/austin/bin/lein -classpath 
/home/austin/.lein/self-installs/leiningen-2.8.1-standalone.jar 
clojure.main -m leiningen.core.main repl

$ lein repl (inside project)

Does not include cause.

java -Dfile.encoding=UTF-8 -Dmaven.wagon.http.ssl.easy=false 
-Dmaven.wagon.rto=10000 -Xverify:none -XX:+TieredCompilation 
-XX:TieredStopAtLevel=1 -Dleiningen.original.pwd=/home/austin/test-project 
-Dleiningen.script=/home/austin/bin/lein -classpath 
/home/austin/.lein/self-installs/leiningen-2.8.1-standalone.jar 
clojure.main -m leiningen.core.main repl

java -classpath 
/home/austin/test-project/test:/home/austin/test-project/src:/home/austin/test-project/dev-resources:/home/austin/test-project/resources:/home/austin/test-project/target/classes:/home/austin/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar:/home/austin/.m2/repository/org/clojure/tools.nrepl/0.2.12/tools.nrepl-0.2.12.jar:/home/austin/.m2/repository/clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.jar
 
-Dfile.encoding=UTF-8 -XX:-OmitStackTraceInFastThrow -XX:+TieredCompilation 
-XX:TieredStopAtLevel=1 
-Dclojure.compile.path=/home/austin/test-project/target/classes 
-Dtest-project.version=0.1.0-SNAPSHOT -Dclojure.debug=false clojure.main -i 
/tmp/form-init3009346480080427936.clj

I'm not sure what to make of this. I don't see anything unusual, but I have 
limited experience with Java.

Why does running `lein repl` in a project directory start two processes?

-austin

On Wednesday, October 24, 2018 at 7:40:28 PM UTC-7, Andy Fingerhut wrote:
>
> I am not sure if this is the reason, but I would recommend checking the 
> command line options used when starting the java process in these cases.  
> Leiningen uses some command line options by default, for faster startup 
> times I think, that might affect how much detail is captured in stack 
> traces when exceptions are created.
>
> Andy
>
> On Wed, Oct 24, 2018 at 6:53 PM Austin Haas <[email protected] 
> <javascript:>> wrote:
>
>> I don't understand what is going on here. I'm trying to throw an 
>> exception with a cause and sometimes the cause is included in the 
>> stacktrace and sometimes it isn't.
>>
>> ~$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version 
>> "1.10.0-beta4"}}}'
>> Clojure 1.10.0-beta4
>> user=> (try (/ 1 0) (catch Exception e "caught"))
>> "caught"
>> user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and 
>> rethrown" e))))
>> Evaluation error (ArithmeticException) at clojure.lang.Numbers.divide (
>> Numbers.java:188).
>> Divide by zero
>> user=> (clojure.repl/pst)
>> ArithmeticException Divide by zero
>>  clojure.lang.Numbers.divide (Numbers.java:188)
>>  clojure.lang.Numbers.divide (Numbers.java:3901)
>>  user$eval3.invokeStatic (:2)
>>  user$eval3.invoke (:2)
>>  clojure.lang.Compiler.eval (Compiler.java:7172)
>>  clojure.lang.Compiler.eval (Compiler.java:7135)
>>  clojure.core/eval (core.clj:3206)
>>  clojure.core/eval (core.clj:3202)
>>  clojure.main/repl/read-eval-print--8898/fn--8901 (main.clj:309)
>>  clojure.main/repl/read-eval-print--8898 (main.clj:307)
>>  clojure.main/repl/fn--8907 (main.clj:332)
>>  clojure.main/repl (main.clj:332)
>> nil
>>
>> Same behavior with Clojure 1.8 and 1.9.
>>
>> If I start a REPL via lein, the cause appears:
>>
>> $ lein repl
>> nREPL server started on port 46767 on host 127.0.0.1 - nrepl://
>> 127.0.0.1:46767
>> REPL-y 0.3.7, nREPL 0.2.12
>> Clojure 1.8.0
>> Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14
>>     Docs: (doc function-name-here)
>>           (find-doc "part-of-name-here")
>>   Source: (source function-name-here)
>>  Javadoc: (javadoc java-object-or-class-here)
>>     Exit: Control+D or (exit) or (quit)
>>  Results: Stored in vars *1, *2, *3, an exception in *e
>>
>>
>> user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and 
>> rethrown" e))))
>>
>>
>> ArithmeticException Divide by zero  clojure.lang.Numbers.divide 
>> (Numbers.java:158)
>> user=> (clojure.repl/pst)
>> java.lang.Exception: caught and rethrown
>>                                   (Unknown Source) user/eval1736
>>                                   (Unknown Source) user/eval1736
>>                                 Compiler.java:6927 clojure.lang.Compiler.
>> eval
>>                                 Compiler.java:6890 clojure.lang.Compiler.
>> eval
>>                                      core.clj:3105 clojure.core/eval
>>                                      core.clj:3101 clojure.core/eval
>>                                       main.clj:240 clojure.main/repl[fn]
>>                                       main.clj:240 clojure.main/repl[fn]
>>                                       main.clj:258 clojure.main/repl[fn]
>>                                       main.clj:258 clojure.main/repl
>>                                       main.clj:174 clojure.main/repl
>>                                   RestFn.java:1523 clojure.lang.RestFn.
>> invoke
>>                          interruptible_eval.clj:87 clojure.tools.nrepl.
>> middleware.interruptible-eval/evaluate[fn]
>>                                       AFn.java:152 clojure.lang.AFn.
>> applyToHelper
>>                                       AFn.java:144 clojure.lang.AFn.
>> applyTo
>>                                       core.clj:646 clojure.core/apply
>>                                      core.clj:1881 clojure.core/with-
>> bindings*
>>                                      core.clj:1881 clojure.core/with-
>> bindings*
>>                                    RestFn.java:425 clojure.lang.RestFn.
>> invoke
>>                          interruptible_eval.clj:85 clojure.tools.nrepl.
>> middleware.interruptible-eval/evaluate
>>                          interruptible_eval.clj:55 clojure.tools.nrepl.
>> middleware.interruptible-eval/evaluate
>>                         interruptible_eval.clj:224 clojure.tools.nrepl.
>> middleware.interruptible-eval/interruptible-eval[fn]
>>                         interruptible_eval.clj:192 clojure.tools.nrepl.
>> middleware.interruptible-eval/run-next[fn]
>>                                        AFn.java:22 clojure.lang.AFn.run
>>                       ThreadPoolExecutor.java:1142 java.util.concurrent.
>> ThreadPoolExecutor.runWorker
>>                        ThreadPoolExecutor.java:617 java.util.concurrent.
>> ThreadPoolExecutor$Worker.run
>>                                    Thread.java:745 java.lang.Thread.run
>> Caused by: java.lang.ArithmeticException: Divide by zero
>>                                   Numbers.java:158 clojure.lang.Numbers.
>> divide
>>                                  Numbers.java:3808 clojure.lang.Numbers.
>> divide
>> nil
>>
>> But if I run lein repl from inside a project directory, the cause is not 
>> included:
>>
>> $ lein new test-project
>> Generating a project called test-project based on the 'default' template.
>> The default template is intended for library projects, not applications.
>> To see other templates (app, plugin, etc), try `lein help new`.
>> ~$ cd test-project/
>> ~/test-project$ lein repl
>> nREPL server started on port 36739 on host 127.0.0.1 - nrepl://127.0.0.1:
>> 36739
>> REPL-y 0.3.7, nREPL 0.2.12
>> Clojure 1.8.0
>> Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14
>>     Docs: (doc function-name-here)
>>           (find-doc "part-of-name-here")
>>   Source: (source function-name-here)
>>  Javadoc: (javadoc java-object-or-class-here)
>>     Exit: Control+D or (exit) or (quit)
>>  Results: Stored in vars *1, *2, *3, an exception in *e
>>
>>
>> user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and 
>> rethrown" e))))
>> ArithmeticException Divide by zero  clojure.lang.Numbers.divide 
>> (Numbers.java:158)
>>
>>
>> user=> (clojure.repl/pst)
>> ArithmeticException Divide by zero
>>  clojure.lang.Numbers.divide (Numbers.java:158)
>>  clojure.lang.Numbers.divide (Numbers.java:3808)
>>  user/eval1244 (form-init6841584094920823421.clj:1)
>>  user/eval1244 (form-init6841584094920823421.clj:1)
>>  clojure.lang.Compiler.eval (Compiler.java:6927)
>>  clojure.lang.Compiler.eval (Compiler.java:6890)
>>  clojure.core/eval (core.clj:3105)
>>  clojure.core/eval (core.clj:3101)
>>  clojure.main/repl/read-eval-print--7408/fn--7411 (main.clj:240)
>>  clojure.main/repl/read-eval-print--7408 (main.clj:240)
>>  clojure.main/repl/fn--7417 (main.clj:258)
>>  clojure.main/repl (main.clj:258)
>> nil
>>
>> Any ideas would be appreciated.
>>
>> -austin
>>
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected] 
>> <javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to