diff --git a/auxbin/jpm b/auxbin/jpm index cd3d4f76..ae52ff64 100755 --- a/auxbin/jpm +++ b/auxbin/jpm @@ -588,16 +588,20 @@ int main(int argc, const char **argv) { (rm manifest) (print "Uninstalled.")) +(defn- rimraf + "Hard delete directory tree" + [path] + (if is-win + # windows get rid of read-only files + (os/shell `rmdir /S /Q "` path `"`)) + (rm path)) + (defn clear-cache "Clear the global git cache." [] (def cache (find-cache)) (print "clearing " cache "...") - (if is-win - # Git for windows decided that .git should be hidden and everything in it read-only. - # This means we can't delete things easily. - (os/shell (string `rmdir /S /Q "` cache `"`)) - (rm cache))) + (rimraf cache)) (def- default-pkglist (or (os/getenv "JANET_PKGLIST") "https://github.com/janet-lang/pkgs.git")) @@ -632,7 +636,9 @@ int main(int argc, const char **argv) { (when (mkdir module-dir) (set fresh true) (print "cloning repository " repo " to " module-dir) - (os/execute ["git" "clone" repo module-dir] :p)) + (unless (zero? (os/execute ["git" "clone" repo module-dir] :p)) + (rimraf module-dir) + (error (string "could not clone git dependency " repo)))) (def olddir (os/cwd)) (try (with-dyns [:rules @{}