1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-22 09:51:44 +08:00

fix(rake-fast): make .rake_tasks write atomic (#12108)

This commit is contained in:
Oleg Grigoriev 2023-12-20 22:52:27 +03:00 committed by GitHub
parent 0bb00eddbb
commit 2a15741656
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,14 +43,17 @@ _tasks_changed () {
}
_rake_generate () {
echo "version:$_rake_tasks_version" > .rake_tasks
rake --silent --tasks --all \
local rake_tasks_content="version:$_rake_tasks_version\n"
rake_tasks_content+=$(rake --silent --tasks --all \
| sed "s/^rake //" | sed "s/\:/\\\:/g" \
| sed "s/\[[^]]*\]//g" \
| sed "s/ *# /\:/" \
| sed "s/\:$//" \
>> .rake_tasks
| sed "s/\:$//")
local rake_tasks_file="$(mktemp -t .rake_tasks.XXXXXX)"
echo $rake_tasks_content > $rake_tasks_file
mv $rake_tasks_file .rake_tasks
}
_rake () {