~ruther/guix-exprs

ref: fee4a9514dd18e9c9809c1ab1a58cf446c95f123 guix-exprs/modules/ruther/build/utils.scm -rw-r--r-- 391 bytes
fee4a951 — Rutherther feat(environment): add package->application-environment for single-app environments 3 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"))))