2023-11-20 09:05:07 -07:00
|
|
|
(define-module (msg helpers)
|
|
|
|
#:use-module (ice-9 ftw)
|
|
|
|
#:use-module (ice-9 popen)
|
|
|
|
#:use-module (ice-9 rdelim)
|
|
|
|
#:use-module (system foreign)
|
|
|
|
#:export (directory-exists?
|
2023-11-25 09:51:23 -07:00
|
|
|
run-shell-command))
|
2023-11-20 09:05:07 -07:00
|
|
|
|
|
|
|
(define (directory-exists? path)
|
|
|
|
(catch 'system-error
|
|
|
|
(lambda ()
|
|
|
|
(stat path))
|
|
|
|
(lambda args #f)))
|
|
|
|
|
|
|
|
(define (run-shell-command command)
|
|
|
|
(let* ((port (open-input-pipe command))
|
|
|
|
(str (read-line port)))
|
2023-11-25 09:51:23 -07:00
|
|
|
(close-pipe port)
|
|
|
|
str))
|
2023-11-20 09:05:07 -07:00
|
|
|
|