~ruther/guix-exprs

ref: bd4c1370aea2bb2bd6f4e0a7afb87a6be5751b23 guix-exprs/modules/ruther/build/utils.scm -rw-r--r-- 391 bytes
bd4c1370 — Rutherther feat: use new rust packaging with ruther packages 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
(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"))))