Make it easier to get to a repl
This commit is contained in:
parent
f02c245652
commit
3225766207
1 changed files with 12 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
(ice-9 match)
|
(ice-9 match)
|
||||||
(ice-9 textual-ports)
|
(ice-9 textual-ports)
|
||||||
(system repl server)
|
(system repl server)
|
||||||
|
(system repl repl)
|
||||||
(gcrypt pk-crypto)
|
(gcrypt pk-crypto)
|
||||||
(guix pki)
|
(guix pki)
|
||||||
(guix-data-service config)
|
(guix-data-service config)
|
||||||
|
|
@ -51,6 +52,9 @@
|
||||||
(alist-cons 'listen-repl port
|
(alist-cons 'listen-repl port
|
||||||
(alist-delete 'listen-repl result))
|
(alist-delete 'listen-repl result))
|
||||||
(error "invalid REPL server port" arg)))))
|
(error "invalid REPL server port" arg)))))
|
||||||
|
(option '("repl") #f #t
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(alist-cons 'repl #t (alist-delete 'repl result))))
|
||||||
(option '("pid-file") #t #f
|
(option '("pid-file") #t #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'pid-file
|
(alist-cons 'pid-file
|
||||||
|
|
@ -120,6 +124,14 @@
|
||||||
(setvbuf (current-error-port) 'line)
|
(setvbuf (current-error-port) 'line)
|
||||||
|
|
||||||
(let ((opts (parse-options (cdr (program-arguments)))))
|
(let ((opts (parse-options (cdr (program-arguments)))))
|
||||||
|
(when (assq-ref opts 'repl)
|
||||||
|
((@@ (ice-9 top-repl) call-with-sigint)
|
||||||
|
(lambda ()
|
||||||
|
(with-postgresql-connection-per-thread
|
||||||
|
"repl"
|
||||||
|
start-repl)))
|
||||||
|
(exit 0))
|
||||||
|
|
||||||
(let ((repl-port (assoc-ref opts 'listen-repl)))
|
(let ((repl-port (assoc-ref opts 'listen-repl)))
|
||||||
(when repl-port
|
(when repl-port
|
||||||
(spawn-server (make-tcp-server-socket #:port repl-port))))
|
(spawn-server (make-tcp-server-socket #:port repl-port))))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue