Commit b7b2ff26 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

kernels: Distinguish between 'exec-kernel' and 'spawn-kernel'.

* jupyter/kernels.scm (exec-kernel): New procedure.
(spawn-kernel): Rewrite to use it.
parent 8954b810
......@@ -33,6 +33,8 @@
#:use-module (srfi srfi-71)
#:export (find-kernel-specs
find-kernel-specs-file
exec-kernel
spawn-kernel
run-kernel
kernel-specs?
......@@ -302,9 +304,9 @@ be in use (but this is racy)."
(values connection kernel)))
(define (spawn-kernel specs connection)
"Spawn the kernel specified by SPECS, a <kernel-specs> record, passing it
CONNECTION serialized to a \"connection file\". Return its PID."
(define (exec-kernel specs connection)
"Execute the kernel specified by SPECS, a <kernel-specs> record, passing it
CONNECTION serialized to a \"connection file\"."
(define connection-file
(string-append "/tmp/guix-kernel/conn/"
(number->string (string-hash
......@@ -324,9 +326,15 @@ CONNECTION serialized to a \"connection file\". Return its PID."
(scm->json (connection->json connection) port
#:pretty #t)))
(apply execlp (first arguments) arguments))
(define (spawn-kernel specs connection)
"Spawn the kernel designated by SPECS, a <kernel-specs> record, as a new
process, and return its PID. Pass it CONNECTION serialized to a \"connection
file\"."
(let ((pid (primitive-fork)))
(if (zero? pid)
(apply execlp (first arguments) arguments)
(exec-kernel specs connection)
pid)))
(define search-path->list
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment