~ chicken-core (chicken-5) 253831d628e17ec73911d6397b17119f9bdc04b7


commit 253831d628e17ec73911d6397b17119f9bdc04b7
Author:     Kooda <kooda@upyum.com>
AuthorDate: Mon Aug 6 15:08:08 2018 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Tue Aug 7 15:04:25 2018 +0200

    Use the SUDO variable in chicken-uninstall, as documented
    
    Also use the `--` argument to the `rm` command.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

diff --git a/chicken-uninstall.scm b/chicken-uninstall.scm
index 9d3ba9b2..1854c685 100644
--- a/chicken-uninstall.scm
+++ b/chicken-uninstall.scm
@@ -50,6 +50,9 @@
 (define force-uninstall #f)
 (define sudo-uninstall #f)
 
+(define sudo-program (or (get-environment-variable "SUDO")
+                         "sudo"))
+
 (define (repo-path)
   (destination-repository
     (if (and cross-chicken (not host-extensions))
@@ -115,7 +118,7 @@
   (cond ((not (file-exists? fname))
          (warning "file does not exist" fname))
         ((and sudo-uninstall (eq? 'unix default-platform))
-         (let ((r (system (string-append "sudo rm -f -r " (qs fname)))))
+         (let ((r (system (string-append sudo-program " rm -f -r -- " (qs fname)))))
            (unless (zero? r)
              (warning "deleting file failed" fname))))
         ((directory-exists? fname)
Trap