lib: add import-env

This commit is contained in:
crater2150 2023-06-01 12:08:31 +02:00
parent 6345cbdb09
commit 3eb81b9445
2 changed files with 9 additions and 4 deletions

View file

@ -64,3 +64,10 @@ pip-venv-deps() {
exit 1
fi
}
import-env() {
SOURCE_PROCESS=$1
SOURCE_PID=$(pgrep $SOURCE_PROCESS | head -n 1)
SOURCE_ENV=("${(@ps:\000:)$(</proc/${SOURCE_PID}/environ)}")
export ${SOURCE_ENV[@]:#}
}