From 0b0b2af07f3da5a15f010cb73cd1515d24b13cc2 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 27 May 2012 20:08:40 -0400 Subject: [PATCH] [Fix #171] Background non-session affecting code --- templates/zlogin | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/templates/zlogin b/templates/zlogin index 8de491d9..2854965a 100644 --- a/templates/zlogin +++ b/templates/zlogin @@ -5,20 +5,21 @@ # Sorin Ionescu # -# Compile the completion dump to increase startup speed. -dump_file="$HOME/.zcompdump" -if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -s "${dump_file}.zwc" ]]; then - zcompile "$dump_file" -fi -unset dump_file +# Execute code that does not affect the current session in the background. +{ + # Compile the completion dump to increase startup speed. + dump_file="$HOME/.zcompdump" + if [[ "$dump_file" -nt "${dump_file}.zwc" || ! -s "${dump_file}.zwc" ]]; then + zcompile "$dump_file" + fi -# Set environment variables for launchd processes. -if [[ "$OSTYPE" == darwin* ]]; then - for env_var in PATH MANPATH; do - launchctl setenv "$env_var" "${(P)env_var}" &! - done - unset env_var -fi + # Set environment variables for launchd processes. + if [[ "$OSTYPE" == darwin* ]]; then + for env_var in PATH MANPATH; do + launchctl setenv "$env_var" "${(P)env_var}" + done + fi +} &! # Print a random, hopefully interesting, adage. if (( $+commands[fortune] )); then