Changeset 9854
- Timestamp:
- Jun 30, 2008, 5:00:02 PM (13 years ago)
- Location:
- branches/working-0711/ccl/level-1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/working-0711/ccl/level-1/l1-error-system.lisp
r9578 r9854 491 491 (apply #'format stream (simple-condition-format-control c) 492 492 (simple-condition-format-arguments c))))) 493 494 (define-condition external-process-creation-failure (serious-condition) 495 ((proc :initarg :proc)) 496 (:report (lambda (c stream) 497 (with-slots (proc) c 498 (let* ((code (external-process-%exit-code proc))) 499 (format stream "Fork failed in ~s: ~a. " proc (if (eql code -1) "random lisp error" (%strerror code)))))))) 500 493 501 494 502 (defun restartp (thing) -
branches/working-0711/ccl/level-1/linux-files.lisp
r9850 r9854 883 883 (remove-external-process p) 884 884 (setq terminated t))))))))) 885 885 886 886 887 (defun run-external-process (proc in-fd out-fd error-fd argv &optional env) 887 888 (let* ((signaled nil)) … … 915 916 (signal-semaphore (external-process-signal proc)))))) 916 917 917 918 (defparameter *silently-ignore-catastrophic-failure-in-run-program* 919 #+ccl-0711 t #-ccl-0711 nil) 920 918 921 (defun run-program (program args &key 919 922 (wait t) pty … … 922 925 (error :output) (if-error-exists :error) 923 926 status-hook (element-type 'character) 924 env) 927 env 928 (silently-ignore-catastrophic-failures 929 *silently-ignore-catastrophic-failure-in-run-program*)) 925 930 "Invoke an external program as an OS subprocess of lisp." 926 931 (declare (ignore pty)) … … 986 991 (wait-on-semaphore (external-process-completed proc)))) 987 992 (if (eq (external-process-%status proc) :error) 988 (error "Fork failed in ~s: ~s" proc (%strerror (external-process-%exit-code proc)))) 989 (and (external-process-pid proc) 990 proc))) 993 (if silently-ignore-catastrophic-failures 994 proc 995 (error 'external-process-creation-failure proc)) 996 (and (external-process-pid proc) 997 proc)))) 991 998 992 999 … … 1071 1078 "Send the specified signal to the specified external process. (Typically, 1072 1079 it would only be useful to call this function if the EXTERNAL-PROCESS was 1073 created with :WAIT NIL.) Return T if successful; signal an error otherwise." 1080 created with :WAIT NIL.) Return T if successful, NIL if the process wasn't 1081 created successfully, and signal an error otherwise." 1074 1082 (require-type proc 'external-process) 1075 (let* ((pid (external-process-pid proc)) 1076 (error (syscall syscalls::kill pid signal))) 1077 (or (eql error 0) 1078 (%errno-disp error)))) 1083 (let* ((pid (external-process-pid proc))) 1084 (when pid 1085 (let* ((error (syscall syscalls::kill pid signal))) 1086 (or (eql error 0) 1087 (%errno-disp error)))))) 1079 1088 1080 1089 ;;; EOF on a TTY is transient, but I'm less sure of other cases.
Note: See TracChangeset
for help on using the changeset viewer.