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 <jviotti@openmailbox.org>
This commit is contained in:
Juan Cruz Viotti 2016-12-05 00:16:13 -04:00 committed by GitHub
parent ce206fc0b7
commit 0c1f9e93ba

View File

@ -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