Skip to content

Commit 8ffe60b

Browse files
committed
Prevents azcopy hiding error messages by redirection
Fixes #6158 Signed-off-by: adamrtalbot <12817534+adamrtalbot@users.noreply.github.com>
1 parent c0cc9cb commit 8ffe60b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

plugins/nf-azure/src/main/nextflow/cloud/azure/file/AzBashLib.groovy

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,27 @@ class AzBashLib extends BashFunLib<AzBashLib> {
7070
azcopy cp "$name" "$target/$dir_name?$AZ_SAS" --recursive --block-blob-tier $AZCOPY_BLOCK_BLOB_TIER --block-size-mb $AZCOPY_BLOCK_SIZE_MB
7171
fi
7272
else
73-
azcopy cp "$name" "$target/$name?$AZ_SAS" --block-blob-tier $AZCOPY_BLOCK_BLOB_TIER --block-size-mb $AZCOPY_BLOCK_SIZE_MB
73+
azcopy cp --output-level quiet "$name" "$target/$name?$AZ_SAS" --block-blob-tier $AZCOPY_BLOCK_BLOB_TIER --block-size-mb $AZCOPY_BLOCK_SIZE_MB
7474
fi
7575
}
7676
7777
nxf_az_download() {
7878
local source=$1
7979
local target=$2
8080
local basedir=$(dirname $2)
81-
local ret
8281
mkdir -p "$basedir"
8382
84-
ret=$(azcopy cp "$source?$AZ_SAS" "$target" 2>&1) || {
85-
## if fails check if it was trying to download a directory
86-
mkdir -p $target
87-
azcopy cp "$source/*?$AZ_SAS" "$target" --recursive >/dev/null || {
88-
rm -rf $target
83+
# Try to download as file first, let azcopy handle the detection
84+
if ! azcopy cp --output-level quiet "$source?$AZ_SAS" "$target"; then
85+
# If failed, remove any partial target and try as directory
86+
rm -rf "$target"
87+
mkdir -p "$target"
88+
if ! azcopy cp --output-level quiet"$source/*?$AZ_SAS" "$target" --recursive; then
89+
rm -rf "$target"
8990
>&2 echo "Unable to download path: $source"
9091
exit 1
91-
}
92-
}
92+
fi
93+
fi
9394
}
9495
'''.stripIndent(true)
9596
}

0 commit comments

Comments
 (0)