Fix error message, use a faster regexp test to search for NULs, forbid empty byte strings.

original commit: fca0ed2111300dcbdb3825bdd319ae284d4ac22f
This commit is contained in:
Eli Barzilay 2011-02-20 12:42:52 -05:00
parent 5b012ac355
commit 5100aad081

View File

@ -101,9 +101,10 @@
[else [else
(for ([s (in-list args)]) (for ([s (in-list args)])
(unless (or (path-string? s) (unless (or (path-string? s)
(and (bytes? s) (and (bytes? s) ((bytes-length s) . > . 0)
(for/and ([b (in-bytes s)]) (positive? b)))) (not (regexp-match? #rx"\0" s))))
(raise-type-error who "path, string, or byte string (no with nuls)" s)))]) (raise-type-error who "path, string, or byte string (without NULs)"
s)))])
args) args)
(define (check-command who str) (define (check-command who str)