Add display, simple-format and format variants
Which call put-bytevector for performing output. When used in combination with an unbuffered port, this should be safer than using the normal Guile procedures, as I think it'll avoid writing to the buffers, while still avoiding single character at a time output. More research is needed though in to how to output to stdout/stderr when using fibers with a parallelism greater than 1.
This commit is contained in:
parent
39ae5177f2
commit
094259b049
3 changed files with 69 additions and 25 deletions
|
|
@ -90,7 +90,7 @@
|
|||
(set-record-type-printer!
|
||||
<resource-pool>
|
||||
(lambda (resource-pool port)
|
||||
(display
|
||||
(display/knots
|
||||
(simple-format #f "#<resource-pool name: \"~A\">"
|
||||
(resource-pool-name resource-pool))
|
||||
port)))
|
||||
|
|
@ -488,8 +488,8 @@
|
|||
(stack-ref stack 3)
|
||||
'%exception
|
||||
(list exn))))))
|
||||
(display error-string
|
||||
(current-error-port)))
|
||||
(display/knots error-string
|
||||
(current-error-port)))
|
||||
(raise-exception exn))
|
||||
(lambda ()
|
||||
(start-stack
|
||||
|
|
@ -1146,8 +1146,8 @@
|
|||
(stack-ref stack 3)
|
||||
'%exception
|
||||
(list exn))))))
|
||||
(display error-string
|
||||
(current-error-port)))
|
||||
(display/knots error-string
|
||||
(current-error-port)))
|
||||
(raise-exception exn))
|
||||
(lambda ()
|
||||
(start-stack
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ on the procedure being called at any particular time."
|
|||
(not (memq 'close (response-connection response))))
|
||||
|
||||
(define (default-read-request-exception-handler exn)
|
||||
(display "While reading request:\n" (current-error-port))
|
||||
(display/knots "While reading request:\n" (current-error-port))
|
||||
(print-exception
|
||||
(current-error-port)
|
||||
#f
|
||||
|
|
@ -302,12 +302,12 @@ on the procedure being called at any particular time."
|
|||
(if (and (exception-with-origin? exn)
|
||||
(string=? (exception-origin exn)
|
||||
"fport_write"))
|
||||
(simple-format
|
||||
(simple-format/knots
|
||||
(current-error-port)
|
||||
"~A ~A: error replying to client\n"
|
||||
(request-method request)
|
||||
(uri-path (request-uri request)))
|
||||
(simple-format
|
||||
(simple-format/knots
|
||||
(current-error-port)
|
||||
"knots web server: ~A ~A: exception replying to client: ~A\n"
|
||||
(request-method request)
|
||||
|
|
@ -329,8 +329,8 @@ on the procedure being called at any particular time."
|
|||
(print-backtrace-and-exception/knots
|
||||
exn
|
||||
#:port port)))))
|
||||
(display error-string
|
||||
(current-error-port)))
|
||||
(display/knots error-string
|
||||
(current-error-port)))
|
||||
|
||||
(values (build-response #:code 500)
|
||||
;; TODO Make this configurable
|
||||
|
|
@ -476,13 +476,17 @@ on the procedure being called at any particular time."
|
|||
(unless (and (exception-with-origin? exn)
|
||||
(string=? (exception-origin exn)
|
||||
"fport_read"))
|
||||
(display "knots web-server, exception in client loop:\n"
|
||||
(current-error-port))
|
||||
(print-exception
|
||||
(current-error-port)
|
||||
#f
|
||||
'%exception
|
||||
(list exn)))
|
||||
(display/knots "knots web-server, exception in client loop:\n"
|
||||
(current-error-port))
|
||||
(display/knots
|
||||
(call-with-output-string
|
||||
(lambda (port)
|
||||
(print-exception
|
||||
port
|
||||
#f
|
||||
'%exception
|
||||
(list exn))))
|
||||
(current-error-port)))
|
||||
#t)
|
||||
(lambda ()
|
||||
(or
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue