REPL

14 views
Skip to first unread message

Abraham Varghese

unread,
Aug 19, 2010, 11:28:12 AM8/19/10
to Clojure
How to exit from REPL?

Meikel Brandmeyer

unread,
Aug 19, 2010, 12:01:43 PM8/19/10
to Clojure
Control-D on Unix, Control-Z Enter on Windows, (System/exit 0)

On 19 Aug., 17:28, Abraham Varghese <abev...@gmail.com> wrote:
> How to exit from REPL?

Nicolas Oury

unread,
Aug 19, 2010, 12:01:49 PM8/19/10
to clo...@googlegroups.com
I use Ctrl+D. But I am on Linux.

On Thu, Aug 19, 2010 at 4:28 PM, Abraham Varghese <abe...@gmail.com> wrote:
> How to exit from REPL?
>

> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

Alan

unread,
Aug 19, 2010, 5:43:02 PM8/19/10
to Clojure
I use Ctrl-D on linux, but Ctrl-C works too, and is what I would try
first on Windows.

(System/exit 0) won't work if you're using leiningen to get your repl,
because it passes I/O through JLine and System.exit terminates the
clojure process without notifying the JLine process:

$ lein repl
user=> (System/exit 0)
���
type some random crap
���Exception in thread "main"
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
at java.lang.reflect.Method.invoke(Method.java:616)
at jline.ConsoleRunner.main(ConsoleRunner.java:69)
Caused by: java.net.SocketException: Broken pipe (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5435)
at clojure.lang.Compiler.eval(Compiler.java:5386)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:458)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:174)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
... 5 more
Caused by: java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:
109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:220)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:290)
at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:294)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:140)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
at java.lang.reflect.Method.invoke(Method.java:616)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:90)
at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:
265)
at leiningen.repl$repl_client.invoke(repl.clj:42)
at leiningen.repl$connect_to_server.invoke(repl.clj:47)
at leiningen.repl$poll_for_socket$fn__1035.invoke(repl.clj:51)
at leiningen.repl$poll_for_socket.invoke(repl.clj:51)
at leiningen.repl$repl.invoke(repl.clj:63)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:540)
at leiningen.core$_main.doInvoke(core.clj:111)
at clojure.lang.RestFn.applyTo(RestFn.java:138)
at clojure.core$apply.invoke(core.clj:540)
at leiningen.core$_main.invoke(core.clj:114)
at user$eval46.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5419)
... 16 more

Meikel Brandmeyer

unread,
Aug 20, 2010, 1:51:17 AM8/20/10
to Clojure
Hi,

On 19 Aug., 23:43, Alan <a...@malloys.org> wrote:

> Ctrl-C works too, and is what I would try first on Windows.

Ctrl-C is a rather hard way to shutdown things. Compare to turning off
the computer without flushing the disk caches. With JLine Ctrl-D also
works on Windows.

Sincerely
Meikel
Reply all
Reply to author
Forward
0 new messages