From 02ae33eb57dbdaaf70c18d3324d40a05778da8f0 Mon Sep 17 00:00:00 2001 From: Pranjal Swarup Date: Wed, 18 Dec 2024 12:42:46 -0500 Subject: [PATCH] Update scripts/merge_multiprocess_output.sh to add a timeout. Co-authored-by: David Galiffi --- scripts/merge_multiprocess_output.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/merge_multiprocess_output.sh b/scripts/merge_multiprocess_output.sh index 028e21d4..d257e45e 100755 --- a/scripts/merge_multiprocess_output.sh +++ b/scripts/merge_multiprocess_output.sh @@ -23,9 +23,15 @@ fi echo "Merging multiprocess files ..." # Check if all .proto files have been fully written or wait +TIMEOUT=60 # Timeout in seconds for file in "${PROTO_FILES[@]}"; do + SECONDS=0 while lsof "$file" > /dev/null 2>&1; do - echo "..." + if [ $SECONDS -ge $TIMEOUT ]; then + echo "Timeout reached while waiting for $file to be released." + break + fi + echo "Waiting for $file to be released..." sleep 1 done done