diff --git a/hack/gendocs/make.sh b/hack/gendocs/make.sh index ed085cec8..05be93449 100755 --- a/hack/gendocs/make.sh +++ b/hack/gendocs/make.sh @@ -14,6 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -pushd $GOPATH/src/stash.appscode.dev/stash/hack/gendocs +set -eou pipefail + +SCRIPT_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/../..) +SCRIPT_NAME=$(basename "${BASH_SOURCE[0]}") +pushd $SCRIPT_ROOT/hack/gendocs + +# http://redsymbol.net/articles/bash-exit-traps/ +function cleanup() { + popd +} +trap cleanup EXIT + go run main.go -popd