21 lines
383 B
Text
21 lines
383 B
Text
|
#!/usr/bin/env python3
|
||
|
#
|
||
|
# Requirements: nrepl-python-client
|
||
|
#
|
||
|
|
||
|
import sys
|
||
|
import nrepl
|
||
|
|
||
|
code = sys.stdin.read().strip()
|
||
|
print(code)
|
||
|
c = nrepl.connect("nrepl://localhost:1667")
|
||
|
c.write({"op": "eval", "code": code})
|
||
|
response = c.read()
|
||
|
try:
|
||
|
print(";; " + response['value'])
|
||
|
except KeyError:
|
||
|
try:
|
||
|
print(";; ERROR: " + response['err'])
|
||
|
except KeyError:
|
||
|
pass
|