mirror of
https://github.com/flatcar/scripts.git
synced 2026-01-22 17:01:49 +01:00
ci-automation/secret_to_file: Fix usage from subshell
This failed when used from ( secret_to_file ... VAR ; cat $VAR ) because ( ) starts a new subshell PID and secret_to_file's returned /proc/PID/fd/X path was then using the wrong PID.
This commit is contained in:
parent
6692b3153f
commit
cd679afbeb
@ -310,7 +310,8 @@ function secret_to_file() {
|
||||
exec {fd}<>"${tmpfile}"
|
||||
rm -f "${tmpfile}"
|
||||
echo "${secret}" | base64 --decode >&${fd}
|
||||
config_ref="/proc/${$}/fd/${fd}"
|
||||
# Use BASHPID because we may be in a subshell but $$ is only the main shell's PID
|
||||
config_ref="/proc/${BASHPID}/fd/${fd}"
|
||||
}
|
||||
# --
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user