~ruther/ruthless-guix

ref: c38c1a6c18e451b0c727f3756433bdfd7fd81426 ruthless-guix/modules/ruther/build/utils.scm -rw-r--r-- 391 bytes
c38c1a6c — Rutherther fix: do not quote name in .guix-channel 8 days 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"))))