Add Licensing and Contributing
[candle] / src / main / git.lisp
1 ; Copyright 2022 Frank Duncan (frank@consxy.com) under AGPL3.  See distributed LICENSE.txt.
2 (in-package #:candle)
3
4 (defvar *git-location* "/usr/bin/git")
5
6 (defun git (project cmd &rest args)
7  (let
8   ((err nil)
9    (out nil)
10    (code nil))
11   (setf
12    err
13    (with-output-to-string (err-str)
14     (setf out
15      (with-output-to-string (out-str)
16       (setf code
17        (sb-ext:process-exit-code
18         (sb-ext:run-program *git-location*
19          (append
20           (list "-C" (if project (project-dir project) *candle-dir*))
21           (list cmd)
22           args)
23          :output out-str
24          :error err-str
25          :wait t)))))))
26   (values (zerop code) code out err)))