2014-03-17 01:16:46 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-07-07 15:00:59 +08:00
|
|
|
set -ex
|
|
|
|
|
2016-11-29 04:50:35 +08:00
|
|
|
BEFORE="./before.tmp"
|
|
|
|
AFTER="./after.tmp"
|
|
|
|
|
2020-02-10 00:41:52 +08:00
|
|
|
cleanup () { echo rm -f "${BEFORE}" "${AFTER}"; }
|
2016-11-29 04:50:35 +08:00
|
|
|
die () { echo "$@" ; cleanup ; exit 1; }
|
|
|
|
|
|
|
|
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${BEFORE}"
|
2020-02-10 00:41:52 +08:00
|
|
|
env | grep -v PATH= | grep -v IFS= | grep -v NVM_ | sort >> "${BEFORE}"
|
2014-03-17 01:16:46 +08:00
|
|
|
|
2017-03-29 00:37:14 +08:00
|
|
|
set +e # TODO: fix
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../nvm.sh
|
2017-03-29 00:37:14 +08:00
|
|
|
set -e
|
2014-03-17 01:16:46 +08:00
|
|
|
|
2016-07-07 15:00:59 +08:00
|
|
|
type nvm > /dev/null 2>&1 || die "nvm not loaded"
|
2014-03-17 01:16:46 +08:00
|
|
|
|
|
|
|
nvm unload
|
|
|
|
|
2016-11-29 04:50:35 +08:00
|
|
|
typeset -f | awk '/ \(\) $/ && !/^main / {print $1}' > "${AFTER}"
|
2020-02-10 00:41:52 +08:00
|
|
|
env | grep -v PATH= | grep -v IFS= | sort >> "${AFTER}"
|
2016-11-29 04:50:35 +08:00
|
|
|
|
2016-07-07 15:00:59 +08:00
|
|
|
! type nvm > /dev/null 2>&1 || die "nvm not unloaded"
|
2016-11-29 04:50:35 +08:00
|
|
|
|
|
|
|
DIFF="$(diff "${BEFORE}" "${AFTER}" ||:)"
|
|
|
|
[ -z "${DIFF}" ] || die "function pollution found: ${DIFF}"
|
|
|
|
|
|
|
|
cleanup
|