guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting broken pipe


From: Dan McMahill
Subject: Re: detecting broken pipe
Date: Mon, 24 Apr 2006 22:10:59 -0400
User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7.6) Gecko/20050412

Kevin Ryde wrote:
Dan McMahill <address@hidden> writes:

ERROR: In procedure write_all:
ERROR: Broken pipe


Yes, that's right, you get a scheme-level error instead of sigpipe
terminating the whole process.  (See `catch' in the guile manual for
trapping that error, or perhaps false-if-exception to ignore it.)


sweet! It seems to be working now. I'm posting what I ended up with so the next lost soul searching the archives can find it. Thanks so much for the help, I really appreciate it.

-Dan

;; Use this instead of
;; (display val pcb:pipe)
;;
(define (pcb:pipe-write val)
  (if pcb:pipe

      ;; pipe is open so try and write out our value
      (begin
        (catch #t

               ;; try to write our value
               (lambda ()
                 (display val pcb:pipe)
                 )

               ;; and if we fail spit out a message
               ;; and set pcb:pipe to false so we don't
               ;; try and write again
               (lambda (key . args)
                 (display "It appears that PCB has terminated.\n")
(display "If this is not the case, you should save and exit and\n")
                 (display "report this as a bug.\n\n")
(display "If you exited PCB on purpose, you can ignore this message\n\n")
                 (set! pcb:pipe #f)
                 )

               )
        )

      ;; pipe is not open so don't try and write to it
      ;;(display "pcb:pipe is not open\n")

      )

)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]