From 0c1f9e93baeda9311c048b42e3f9f756c48e011a Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 5 Dec 2016 00:16:13 -0400 Subject: [PATCH] chore: use `rmdir` to delete empty npm `etc/` directory (#933) NPM might create an empty `etc/` directory when calling it with the `--prefix` option and we have a check to see if this directory indeed exists and its empty in order to proceed and delete it. We currently use `rm -rf` for it, even though `rmdir` is sufficient. See: https://github.com/resin-io/etcher/pull/923#discussion_r90570968 Signed-off-by: Juan Cruz Viotti --- scripts/unix/dependencies-npm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/unix/dependencies-npm.sh b/scripts/unix/dependencies-npm.sh index 601db3de..e4d14a33 100755 --- a/scripts/unix/dependencies-npm.sh +++ b/scripts/unix/dependencies-npm.sh @@ -114,7 +114,7 @@ if [ -n "$ARGV_PREFIX" ]; then # Using `--prefix` might cause npm to create an empty `etc` directory if [ ! "$(ls -A "$ARGV_PREFIX/etc")" ]; then - rm -rf "$ARGV_PREFIX/etc" + rmdir "$ARGV_PREFIX/etc" fi fi