clean rm of copied dirs and files (#799)
This commit is contained in:
parent
b4b7d1bc1c
commit
59ca59cfc1
|
@ -209,6 +209,8 @@ out={out_path}
|
|||
mkdir -p "$(dirname "$out")"
|
||||
if [[ -f "$in" ]]; then
|
||||
echo "Copying file $in to $out in $PWD"
|
||||
# in case `cp` from previous command was terminated midway which can result in read-only files/dirs
|
||||
chmod -R ug+w "$out" > /dev/null 2>&1 || true
|
||||
rm -Rf "$out"
|
||||
cp -f "$in" "$out"
|
||||
# cp should make the file writable but call chmod anyway as a defense in depth
|
||||
|
@ -217,6 +219,8 @@ if [[ -f "$in" ]]; then
|
|||
{executable_file}
|
||||
else
|
||||
echo "Copying directory $in to $out in $PWD"
|
||||
# in case `cp` from previous command was terminated midway which can result in read-only files/dirs
|
||||
chmod -R ug+w "$out" > /dev/null 2>&1 || true
|
||||
rm -Rf "$out"/*
|
||||
mkdir -p "$out"
|
||||
cp -fRL "$in"/* "$out"
|
||||
|
|
Loading…
Reference in New Issue