feat: inject the dokku PID into temporary files/directories
This will allow background processes to cleanup these files if they were unable to be cleaned up during a run of the dokku binary, as is the case for files copied by the docker binary when running in docker.
This commit is contained in:
@@ -42,7 +42,7 @@ certs_set() {
|
||||
# importing from file
|
||||
true
|
||||
elif is_tar_import; then
|
||||
local CERTS_SET_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${FUNCNAME[0]}.XXXX")
|
||||
local CERTS_SET_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXX")
|
||||
pushd "$CERTS_SET_TMP_WORK_DIR" &>/dev/null
|
||||
trap "popd &>/dev/null || true; rm -rf '$CERTS_SET_TMP_WORK_DIR' >/dev/null" RETURN
|
||||
tar xvf - <&0
|
||||
|
||||
@@ -13,7 +13,7 @@ certs_generate_cmd() {
|
||||
local APP_SSL_PATH="$DOKKU_ROOT/$APP/tls"
|
||||
|
||||
if [[ ! -f "$APP_SSL_PATH/server.key" ]] && [[ ! -f "$APP_SSL_PATH/server.crt" ]]; then
|
||||
local CERTS_GENERATE_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${FUNCNAME[0]}.XXXX")
|
||||
local CERTS_GENERATE_TMP_WORK_DIR=$(mktemp -d "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXX")
|
||||
pushd "$CERTS_GENERATE_TMP_WORK_DIR" >/dev/null
|
||||
trap "popd &>/dev/null || true; rm -rf '$CERTS_GENERATE_TMP_WORK_DIR' >/dev/null" INT TERM EXIT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user