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

feat(decl/scripts): replace sh with bash #253

Merged
merged 1 commit into from
Jan 7, 2025
Merged
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
6 changes: 3 additions & 3 deletions pkg/test/script/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ __SLEEP_PID=

# __cleanup is used as handler for SIGTERM and SIGINT signals, as well as handler for script EXIT pseudo-signal.
__cleanup() {
[ -n "$__SLEEP_PID" ] && kill -9 $__SLEEP_PID
[[ -n "$__SLEEP_PID" ]] && kill -9 $__SLEEP_PID
exit
}

Expand Down Expand Up @@ -80,7 +80,7 @@ wait $__SLEEP_PID

# The SIGUSR1 signal triggers __usr1 handler invocation and sets the exit code to 138. Existing from wait, we check if
# the exit code value is as expected and reset it to 0; otherwise, we return the obtained exit code.
if [ $? != 138 ]; then
if [[ $? != 138 ]]; then
echo "Wait on sleep unblocked due to a reason different from USR1 signal" >&2
exit $?
else
Expand Down Expand Up @@ -121,7 +121,7 @@ func (s *shellScript) RunBefore(ctx context.Context) (func(context.Context) erro
}

processCtx, cancel := context.WithCancel(context.Background())
cmd := exec.CommandContext(processCtx, "sh", "-c", script) //nolint:gosec // Disable G204
cmd := exec.CommandContext(processCtx, "bash", "-c", script) //nolint:gosec // Disable G204
cmd.Cancel = func() error {
return cmd.Process.Signal(unix.SIGTERM)
}
Expand Down
Loading