import-env: fail if no matching process is found
This commit is contained in:
parent
d5fa2e99de
commit
9b6c44cce0
7 changed files with 8 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
import-env() {
|
||||
SOURCE_PROCESS=$1
|
||||
SOURCE_PID=$(pgrep $SOURCE_PROCESS | head -n 1)
|
||||
if [[ -z $SOURCE_PID ]]; then return 1; fi
|
||||
SOURCE_ENV=("${(@ps:\000:)$(</proc/${SOURCE_PID}/environ)}")
|
||||
export ${SOURCE_ENV[@]:#}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue