(define-module (ruther build utils) #:use-module (ice-9 popen) #:use-module (ice-9 textual-ports) #:export (file-is-text-file?)) (define (file-is-text-file? file) (let* ((port (open-input-pipe (string-append "file -b0 --mime-encoding " (canonicalize-path file)))) (output (get-string-all port))) (close-pipe port) (not (string-contains output "binary"))))