~ruther/ruthless-guix

ref: 315db53cf17de715449f705767ab9830ad3df971 ruthless-guix/modules/ruther/build/utils.scm -rw-r--r-- 391 bytes
315db53c — Rutherther feat: add codex-acp 10 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"))))