cl-ipp

Internet Printing Protocol (IPP) for Common Lisp
git clone https://logand.com/git/cl-ipp.git/
Log | Files | Refs

commit 07279832f5815cc62252d1f0593923a56cbd84b6
parent 2984496584c9e077befb37bf5b1a8727805e2d73
Author: Tomas Hlavaty <tom@logand.com>
Date:   Sat, 10 Aug 2013 20:48:36 +0200

ipp.wget::run-command introduced for better error reporting

Diffstat:
Mipp.lisp | 22+++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/ipp.lisp b/ipp.lisp @@ -295,8 +295,16 @@ (in-package :ipp.wget) +(defun run-command (cmd args &optional error-plist) + (let ((code + #+ccl(ccl::external-process-%exit-code (ccl:run-program cmd args)) + #-ccl(error "TODO port IPP.WGET::RUN-COMMAND"))) + (unless (zerop code) + (let ((reason (or (cdr (assoc code error-plist)) ""))) + (error (format nil "~a error ~d: ~a ~s" cmd code reason args)))))) + (defun wget (url &key request-file response-file content-type) - (ccl:run-program + (run-command "wget" `("-q" ,@ (when request-file @@ -305,7 +313,15 @@ `("-O" ,response-file)) ,@ (when content-type `("--header" ,(format nil "Content-Type:~a" content-type))) - ,url))) + ,url) + '((1 . "Generic panic code") + (2 . "Parse panic") + (3 . "File I/O panic") + (4 . "Network failure") + (5 . "SSL verification failure") + (6 . "Username/password authentication failure") + (7 . "Protocol panics") + (8 . "Server issued an panic response")))) ;;(wget "http://localhost:631/printers/" :response-file "/tmp/a.html") @@ -336,7 +352,7 @@ (in-package :ipp.curl) (defun curl (url &key request-file response-file content-type) - (ccl:run-program + (ipp.wget::run-command "curl" `("-s" ,@ (when request-file