Skip to content

Commit

Permalink
Start swank if the environment variable is set.
Browse files Browse the repository at this point in the history
Added a swank script for Windows.
  • Loading branch information
Shawn Hoover committed Mar 24, 2010
1 parent a7085c7 commit f27f975
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion script/repl.bat
Expand Up @@ -7,4 +7,8 @@ for /R ./lib %%a in (*.jar) do (
set CLASSPATH=!CLASSPATH!"
set CLASSPATH=%CLASSPATH%;src;test;config;data
echo CLASSPATH=%CLASSPATH%
java -Xmx1G -cp %CLASSPATH% jline.ConsoleRunner clojure.main -i script/run.clj -r

@rem jline breaks inferior-lisp.
if not defined LABREPL_SWANK set JLINE=jline.ConsoleRunner

java -Xmx1G -cp %CLASSPATH% %JLINE% clojure.main -i script/run.clj -r
9 changes: 8 additions & 1 deletion script/run.clj
@@ -1,3 +1,10 @@
(when-let [run-swank (System/getenv "LABREPL_SWANK")]
(println "Starting swank...")
;; Drop the enclosing double quotes from the environment variable and eval it.
(load-string (if (re-find #"^\".*\"$" run-swank)
(->> run-swank (drop 1) (butlast) (apply str))
run-swank)))

(require 'labrepl)
(set! *print-length* 100)
(labrepl/-main)
(labrepl/-main)
4 changes: 4 additions & 0 deletions script/swank.bat
@@ -0,0 +1,4 @@
@echo off
setlocal
set LABREPL_SWANK="(require 'swank.swank) (swank.swank/start-repl 4005)"
call %~dp0repl.bat

0 comments on commit f27f975

Please sign in to comment.