fix: a transcript rescue never replaces an earlier one
The destination name has one-second granularity and mv overwrites. Closing, re-hosting and closing the same party name within a second would lose the first transcript while reporting success. Fall back to a PID-suffixed name when the destination already exists.
This commit is contained in:
parent
471ee5875c
commit
3fe5615ffe
2 changed files with 21 additions and 1 deletions
6
party
6
party
|
|
@ -943,7 +943,11 @@ rescue_transcript() {
|
|||
sleep 1
|
||||
done
|
||||
fi
|
||||
_rt_dest="$HOME/party-$_rt_name-$(date -u '+%Y%m%d-%H%M%S').log"
|
||||
_rt_dest="$HOME/party-$_rt_name-$(date -u '+%Y%m%d-%H%M%S')"
|
||||
# Same name rescued twice within a second (close, re-host, close):
|
||||
# mv would replace the earlier transcript without a word.
|
||||
[ ! -e "$_rt_dest.log" ] || _rt_dest="$_rt_dest-$$"
|
||||
_rt_dest="$_rt_dest.log"
|
||||
mv "$_rt_dir/log" "$_rt_dest" 2>/dev/null || { _rt_dest=''; return 1; }
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue