bournish: Handle EOF in the reader.
authorLudovic Courtès <ludo@gnu.org>
Mon, 6 Jun 2016 16:06:58 +0000 (18:06 +0200)
committerLudovic Courtès <ludo@gnu.org>
Mon, 6 Jun 2016 16:14:52 +0000 (18:14 +0200)
* guix/build/bournish.scm (read-bournish): Add case for EOF.

guix/build/bournish.scm

index 4022796..3bea1c8 100644 (file)
@@ -134,8 +134,10 @@ commands such as 'ls' and 'cd'; it lacks globbing, pipes---everything.\n"))
 (define (read-bournish port env)
   "Read a Bournish expression from PORT, and return the corresponding Scheme
 code as an sexp."
-  (match (string-tokenize (read-line port))
-    ((command args ...)
+  (match (read-line port)
+    ((? eof-object? eof)
+     eof)
+    ((= string-tokenize (command args ...))
      (match (assoc command %commands)
        ((command proc)                            ;built-in command
         (apply proc (map expand-variable args)))