Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spawning subrepl using main/repl not working. #2017

Closed
maacl opened this issue Jun 18, 2017 · 3 comments
Closed

Spawning subrepl using main/repl not working. #2017

maacl opened this issue Jun 18, 2017 · 3 comments

Comments

@maacl
Copy link

maacl commented Jun 18, 2017

Expected behavior

At cider repl:

(defn foo
  [n]
  (cond (> n 40) (+ n 20)
        (> n 20) (- (first n) 20)
        :else 0))

(require '[clojure.main :as main])
(main/repl :caught (fn [_] (println "Broken! HaHa!")))

(foo 24)
=> Broken! HaHa!

Actual behavior

(defn foo
  [n]
  (cond (> n 40) (+ n 20)
        (> n 20) (- (first n) 20)
        :else 0))

(require '[clojure.main :as main])
(main/repl :caught (fn [_] (println "Broken! HaHa!")))

Jumps to minibuffer with a stdin: prompt.

Steps to reproduce the problem

See above.

Environment & Version information

CIDER version information

CIDER 0.15.0-snapshot, nREPL 0.2.12
Clojure 1.8.0, Java 1.8.0_131

Lein/Boot version

N/A

Emacs version

Emacs 26.0.50

Operating system

Ubuntu 17.04

@TimoFreiberg
Copy link

Seems like an nREPL problem (if you can call it a problem).
Immediately after printing the prompt, nREPL asks for stdin input (the last message in the following snippet).
nREPL asks for stdin because the implementation of clojure.main/repl reads from *in*.
So you're right @bbatsov , this seems related to the follow-up issue of 2317

At the moment I would say "not a bug", but maybe the stdin handling of nREPL could be improved :).

nREPL messages:

(-->
  id                 "11"
  op                 "eval"
  session            "3e6c03a1-b531-46cc-bd36-df172ec81f9c"
  time-stamp         "2018-06-27 20:02:22.592855479"
  code               "(main/repl :caught (fn [_] (println \"Broken! HaHa!\")))"
  column             9
  content-type       "true"
  file               "*cider-repl filter(clj)*"
  line               55
  ns                 "filter.core"
  pprint             "true"
  pprint-fn          "clojure.pprint/pprint"
  print-right-margin 80
)
(<--
  id         "11"
  session    "3e6c03a1-b531-46cc-bd36-df172ec81f9c"
  time-stamp "2018-06-27 20:02:22.611202068"
  out        "filter.core=> "
)
(<--
  id         "11"
  session    "3e6c03a1-b531-46cc-bd36-df172ec81f9c"
  time-stamp "2018-06-27 20:02:22.612512035"
  status     ("need-input")
)

@stale
Copy link

stale bot commented May 8, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the stale label May 8, 2019
@bbatsov bbatsov added the nREPL label May 11, 2019
@stale stale bot removed the stale label May 11, 2019
@bbatsov
Copy link
Member

bbatsov commented May 11, 2019

I'll close this, as it has to be solved in nREPL. See nrepl/nrepl#45

@bbatsov bbatsov closed this as completed May 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants