1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-24 07:20:27 +00:00

Check bundle listing before reinstall.

This commit is contained in:
Calvin Rose 2024-05-26 10:28:19 -05:00
parent f7c90bc1ff
commit 7efb39d608
2 changed files with 7 additions and 2 deletions

View File

@ -4323,7 +4323,8 @@
(def absdest (string (dyn *syspath*) s dest)) (def absdest (string (dyn *syspath*) s dest))
(unless (os/mkdir absdest) (unless (os/mkdir absdest)
(errorf "collision at %s, directory already exists" 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 (when chmod-mode
(os/chmod absdest chmod-mode)) (os/chmod absdest chmod-mode))
(print "add " absdest) (print "add " absdest)
@ -4339,7 +4340,8 @@
(when (os/stat absdest :mode) (when (os/stat absdest :mode)
(errorf "collision at %s, file already exists" absdest)) (errorf "collision at %s, file already exists" absdest))
(copyfile src absdest) (copyfile src absdest)
(array/push files (os/realpath absdest)) (def absdest (os/realpath absdest))
(array/push files absdest)
(when chmod-mode (when chmod-mode
(os/chmod absdest chmod-mode)) (os/chmod absdest chmod-mode))
(print "add " absdest) (print "add " absdest)

View File

@ -62,6 +62,9 @@
(assert-no-error "sample-dep2" (assert-no-error "sample-dep2"
(bundle/install "./examples/sample-dep2")) (bundle/install "./examples/sample-dep2"))
(assert-no-error "sample-dep1" (bundle/install "./examples/sample-dep1")) (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-dep2 reinstall" (bundle/reinstall "sample-dep2"))
(assert-no-error "sample-dep1 reinstall" (bundle/reinstall "sample-dep1" :auto-remove true)) (assert-no-error "sample-dep1 reinstall" (bundle/reinstall "sample-dep1" :auto-remove true))