Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pipe instead of using process expansion #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions shmig
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,12 @@ pending_migrations(){
previous_migrations(){
local version=""

while read -r version
"${TYPE}_previous_versions" "$1" | while read -r version
do
local migration=$(find_migrations -name "$version-*.sql")
[[ -z $migration ]] && die "${LRED}migration version ${LYELLOW}$version ${LRED}can't be found${CLEAR}"
echo "$migration"
done < <("${TYPE}_previous_versions" "$1")
done

# shellcheck disable=SC2181
[[ $? -ne 0 ]] && exit 1
Expand Down Expand Up @@ -583,7 +583,7 @@ migrate(){
is_numeric "$stopver" || die "${LYELLOW}TILL${LRED} should be numeric${CLEAR}"

local fname=""
while read -r fname
"$src" "$steps" | while read -r fname
do
local version=$(migration_version "$fname")
local name=$(migration_name "$fname")
Expand Down Expand Up @@ -614,7 +614,7 @@ migrate(){
fi

[[ ${PIPESTATUS[0]} -eq 0 && ${PIPESTATUS[1]} -eq 0 ]] || exit 1
Copy link
Owner

@mbucc mbucc Oct 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PIPESTATUS is bash-only. (ksh is lower case pipestatus.) Must not hit this line in the Alpine ash tests.

done < <("$src" "$steps")
done
}

# a wrapper for migrate that applies migrations
Expand Down