Skip to content

Instantly share code, notes, and snippets.

@ChanderG
Created April 9, 2024 12:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChanderG/d05b93b7e604ee42f492b8ad9bb13634 to your computer and use it in GitHub Desktop.
Save ChanderG/d05b93b7e604ee42f492b8ad9bb13634 to your computer and use it in GitHub Desktop.
Fork/Exec in CL using CFFI
;(ql:quickload "cffi")
(require :cffi)
(defcfun "fork" :int)
(defcfun "execvp" :int
(file :string)
(argv (:pointer :string)))
(defun test ()
(let ((pid (fork)))
(if (eq pid 0)
(execvp "kitty" (foreign-alloc :string :initial-contents '("kitty")))
(progn
(format t "Child pid: ~a~%" pid)
(sleep 100)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment