guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: Make it easier to get to a repl


From: Christopher Baines
Subject: 02/02: Make it easier to get to a repl
Date: Sat, 10 Oct 2020 08:49:18 -0400 (EDT)

cbaines pushed a commit to branch master
in repository data-service.

commit 3225766207ed0608476c0caa2f2dcf67f8f2462f
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sat Oct 10 13:44:37 2020 +0100

    Make it easier to get to a repl
---
 scripts/guix-data-service.in | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in
index d3ed0d8..ade3ca3 100644
--- a/scripts/guix-data-service.in
+++ b/scripts/guix-data-service.in
@@ -28,6 +28,7 @@
              (ice-9 match)
              (ice-9 textual-ports)
              (system repl server)
+             (system repl repl)
              (gcrypt pk-crypto)
              (guix pki)
              (guix-data-service config)
@@ -51,6 +52,9 @@
                         (alist-cons 'listen-repl port
                                     (alist-delete 'listen-repl result))
                         (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
                 (lambda (opt name arg result)
                   (alist-cons 'pid-file
@@ -120,6 +124,14 @@
 (setvbuf (current-error-port) 'line)
 
 (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)))
     (when repl-port
       (spawn-server (make-tcp-server-socket #:port repl-port))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]