2 ms·
That's very Lispy, actually. (defun ps (process-name) (labels ((find-proc (name) (remove-if-not (lambda (x) (string= (bt:thread-na
by mahmud 17y ago
That's very Lispy, actually.
(defun ps (process-name)
(labels ((find-proc (name)
(remove-if-not
(lambda (x)
(string= (bt:thread-name x) name))
(bt:all-threads))))
(first (find-proc process-name))))
(defun kill (process)
(bt:destroy-thread process))
;; usage
(kill (ps "init"))
And if you remake PS into a generic function you can dispatch on various input types, not just find process by name.