2023-08-20 15:21:42 +00:00
|
|
|
import-env() {
|
|
|
|
SOURCE_PROCESS=$1
|
|
|
|
SOURCE_PID=$(pgrep $SOURCE_PROCESS | head -n 1)
|
2023-09-04 07:59:24 +00:00
|
|
|
if [[ -z $SOURCE_PID ]]; then return 1; fi
|
2023-08-20 15:21:42 +00:00
|
|
|
SOURCE_ENV=("${(@ps:\000:)$(</proc/${SOURCE_PID}/environ)}")
|
|
|
|
export ${SOURCE_ENV[@]:#}
|
|
|
|
}
|