Index: mutils/mutils.scm ================================================================== --- mutils/mutils.scm +++ mutils/mutils.scm @@ -17,11 +17,11 @@ (import chicken scheme ;; data-structures posix srfi-1 ;; srfi-13 srfi-69 - ;; ports + ports extras regex posix data-structures ) @@ -201,14 +201,21 @@ (lambda () (print "You can delete this file"))) (delete-file fname) #t))))) -;; (define (confirm-ssh-access-to-host hostname) - +;; (define (confirm-ssh-access-to-host hostname + +(define (check-display dsp) + (let-values (((inp oup pid) + (process "xdpyinfo" `("-display" ,dsp)))) + (let ((res (with-input-from-port inp read-lines))) + (let-values (((pidres status estatus) + (process-wait pid))) + (and status (eq? estatus 0)))))) -;; do some sanity checks on the system + ;; do some sanity checks on the system ;; (define (mutils:syscheck proc) ;; current dir writeable and do megatest.config, runconfigs.config files exist/readable (print "Current directory " (current-directory) " writeable: " (if (check-write-create ".") "yes" "NO")) @@ -221,15 +228,16 @@ (print "$DISPLAY set: " (if (get-environment-variable "DISPLAY") (conc (get-environment-variable "DISPLAY") " yes") "NO")) (print "$DISPLAY accessible? " - (if (eq? (system "xdpyinfo -display $DISPLAY &>/dev/null;") 0) + ;; (eq? (system "xdpyinfo -display $DISPLAY &>/dev/null") 0) + (if (check-display (get-environment-variable "DISPLAY")) "yes" "NO")) ;; check load on homehost ;; each run disk read/write ;; link tree writeable ) )