benwbooth / quick-clojure

Run clojure scripts and lein commands quickly using a persistent nREPL session
Eclipse Public License 1.0
47 stars 4 forks source link

A couple of repl fixes #3

Closed memeplex closed 9 years ago

memeplex commented 10 years ago

I'm not in the mood of forking and pull requesting right now. But here are a couple of fixes:

diff --git a/quick b/quick
index 6b44286..381f8c6 100755
--- a/quick
+++ b/quick
@@ -80,7 +80,7 @@ def start_nrepl(port=None, toplevel=False):
     port = None
     while port is None and line is not None:
         print(line, end='', file=sys.stderr)
-        match = re.match(r"^nREPL server started on port ([0-9]+) on host ([^ ]+)$", line.rstrip())
+        match = re.match(r"^.*port ([0-9]+).*$", line.rstrip())
         if match is not None:
             port = int(match.group(1))
             break
@@ -206,7 +206,7 @@ def repl(port=None, con=None):
     # get a connection
     if port is None: port = start()
     if con is None:
-        url = 'nrepl://localhost:%i' % (port)
+        url = 'nrepl://localhost:%i' % (int(port))
         con = nrepl.connect(native_str(url))

     # get a session

The addressed problems: