Fix broken rmdir script
Unfortunately, the removal shell script introduced in #10860 does not handle paths very well that dont exist, e.g. * `find` runs before its `-exec` test, thus throws `find: "${path}": No such file or directory` * it seem that `/bin/rmdir` is intended to break is certain cases, thus `-f` is not desired. so, if `${path}` does not exist, it'll still break, which is most likely not one of those cases. This change reintroduces a check for existence. This way, it is ensured that there is actually a directory to be removed when invoking the script.
This commit is contained in:
parent
59ada80ca7
commit
7a22cda8dd
@ -135,6 +135,8 @@ module Cask
|
|||||||
|
|
||||||
sig { params(path: T.any(Pathname, T::Array[Pathname])).void }
|
sig { params(path: T.any(Pathname, T::Array[Pathname])).void }
|
||||||
def rmdir(path)
|
def rmdir(path)
|
||||||
|
return unless path.exist?
|
||||||
|
|
||||||
@command.run!(
|
@command.run!(
|
||||||
"/usr/bin/xargs",
|
"/usr/bin/xargs",
|
||||||
args: ["-0", "--", "/bin/bash", "-c", RMDIR_SH, "--"],
|
args: ["-0", "--", "/bin/bash", "-c", RMDIR_SH, "--"],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user