changelog shortlog graph tags branches changeset file revisions annotate raw help

Mercurial > core / lisp/lib/cli/tools/cargo.lisp

revision 591: f9279a1f2347
parent 517: ed9021bf5cef
     1.1--- a/lisp/lib/cli/tools/cargo.lisp	Mon Aug 12 21:44:58 2024 -0400
     1.2+++ b/lisp/lib/cli/tools/cargo.lisp	Mon Aug 12 21:47:02 2024 -0400
     1.3@@ -4,3 +4,20 @@
     1.4 
     1.5 ;;; Code:
     1.6 (in-package :cli/tools/cargo)
     1.7+
     1.8+(deferror cargo-error (simple-error error) ())
     1.9+
    1.10+(defun cargo-error (fmt &rest args)
    1.11+  (error 'cargo-error :format-arguments args :format-control fmt))
    1.12+
    1.13+(defparameter *cargo* (find-exe "cargo"))
    1.14+
    1.15+(defun run-cargo (&rest args)
    1.16+  (let ((proc (sb-ext:run-program *cargo* (or args nil) :output :stream)))
    1.17+    (with-open-stream (s (sb-ext:process-output proc))
    1.18+      (loop for l = (read-line s nil nil)
    1.19+            while l
    1.20+            do (write-line l)))
    1.21+    (if (eq 0 (sb-ext:process-exit-code proc))
    1.22+        nil
    1.23+        (cargo-error "CARGO command failed: ~A ~A" *cargo* (or args "")))))