(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?
	    run-shell-command))

(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)))
    (close-pipe port)
    str))