Lisp HUG Maillist Archive

unix kill?


Is there a way in LispWorks to send a signal to a process in Unix?
Something equivalent to the kill(2) function in C.

I couldn't find one so I'm using this Fine Hack:

  (sys:run-shell-command (format nil "kill -~a ~a" sig pid))

Thanks!

Regards,
Chris Dean


Re: unix kill?



On 5/22/06, Chris Dean <ctdean@sokitomi.com> wrote:


Is there a way in LispWorks to send a signal to a process in Unix?
Something equivalent to the kill(2) function in C.


You can use the fli to hook into the C kill(2) function.
eg (untested as i'm on Windows right now).

(fli:define-foreign-function (unix-kill "kill")
((pid :integer) (signal :integer))
:result-type :integer)

(defun kill (pid &optional (signal 0))
(unless (zerop (unix-kill pid signal))
(error 'simple-error
:format-control (get-unix-error (errno-value)))))

Cheers,
Sean.
 


Updated at: 2020-12-10 08:48 UTC