aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-03-09 19:52:33 +0000
committerChristopher Baines <mail@cbaines.net>2023-03-09 19:52:33 +0000
commit4e6cc41198515bf4926defd739766c2e1b43c9c9 (patch)
tree9f92e6d38482cc7ce2b7fd3d25f167088a1372fe /scripts
parentcd5687118de9858ac714d55800c2648969dbbb48 (diff)
downloadqa-frontpage-4e6cc41198515bf4926defd739766c2e1b43c9c9.tar
qa-frontpage-4e6cc41198515bf4926defd739766c2e1b43c9c9.tar.gz
Add repl related options
Diffstat (limited to 'scripts')
-rw-r--r--scripts/guix-qa-frontpage.in24
1 files changed, 23 insertions, 1 deletions
diff --git a/scripts/guix-qa-frontpage.in b/scripts/guix-qa-frontpage.in
index 7070592..0c27092 100644
--- a/scripts/guix-qa-frontpage.in
+++ b/scripts/guix-qa-frontpage.in
@@ -40,7 +40,15 @@
(define %options
;; Specifications of the command-line options
- (list (option '("repl") #f #t
+ (list (option '("listen-repl") #f #t
+ (lambda (opt name arg result)
+ (let ((port (cond (arg => string->number)
+ (else %default-repl-server-port))))
+ (if port
+ (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
@@ -70,6 +78,11 @@
(lambda (opt name _ result)
(alist-cons 'manage-patch-branches #t result)))))
+(define %default-repl-server-port
+ ;; Default port to run REPL server on, if --listen-repl is provided
+ ;; but no port is mentioned
+ 37146)
+
(define %default-options
;; Alist of default option values
`((port . 8765)
@@ -100,6 +113,15 @@
(setvbuf (current-error-port) 'line)
(let ((opts (parse-options (cdr (program-arguments)))))
+ (when (assq-ref opts 'repl)
+ ((@@ (ice-9 top-repl) call-with-sigint)
+ start-repl)
+ (exit 0))
+
+ (let ((repl-port (assoc-ref opts 'listen-repl)))
+ (when repl-port
+ (spawn-server (make-tcp-server-socket #:port repl-port))))
+
(let ((pid-file (assq-ref opts 'pid-file)))
(when pid-file
(call-with-output-file pid-file