From 7efb39d60820a66f2092f671e04f4ba3a18b9e20 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sun, 26 May 2024 10:28:19 -0500 Subject: [PATCH] Check bundle listing before reinstall. --- src/boot/boot.janet | 6 ++++-- test/suite-bundle.janet | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/boot/boot.janet b/src/boot/boot.janet index e7e9d489..aebf8b13 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -4323,7 +4323,8 @@ (def absdest (string (dyn *syspath*) s dest)) (unless (os/mkdir absdest) (errorf "collision at %s, directory already exists" absdest)) - (array/push files (os/realpath absdest)) + (def absdest (os/realpath absdest)) + (array/push files absdest) (when chmod-mode (os/chmod absdest chmod-mode)) (print "add " absdest) @@ -4339,7 +4340,8 @@ (when (os/stat absdest :mode) (errorf "collision at %s, file already exists" absdest)) (copyfile src absdest) - (array/push files (os/realpath absdest)) + (def absdest (os/realpath absdest)) + (array/push files absdest) (when chmod-mode (os/chmod absdest chmod-mode)) (print "add " absdest) diff --git a/test/suite-bundle.janet b/test/suite-bundle.janet index 645616c3..ef618e80 100644 --- a/test/suite-bundle.janet +++ b/test/suite-bundle.janet @@ -62,6 +62,9 @@ (assert-no-error "sample-dep2" (bundle/install "./examples/sample-dep2")) (assert-no-error "sample-dep1" (bundle/install "./examples/sample-dep1")) + +(assert (= 2 (length (bundle/list))) "bundles are listed correctly 0") + (assert-no-error "sample-dep2 reinstall" (bundle/reinstall "sample-dep2")) (assert-no-error "sample-dep1 reinstall" (bundle/reinstall "sample-dep1" :auto-remove true))