Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prompt update and TRAPCHLD
- X-seq: zsh-workers 37724
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: prompt update and TRAPCHLD
- Date: Thu, 21 Jan 2016 11:13:55 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=BXADgBWKJ/kpaVVTA3rDzITCwEC7bReQ3O7pWA5LMxs=; b=Et+fTovgYCTBhpJ4CkZW0UCsDB4DxvroJlBTtOaHq62E0wTtWNN3zdxi6LCGcV0OLI W8ZiEsVLG9l4NLn/HnKVM11fb2XlobNPJFp3DU83L9dti2F8GQkpiA6ZnSwbR0OLokdI 3ppkyCODozcJRaeZjwEcqA0eMpJTnIM4p6/p2+pwwbz7Zr/YBWyzl6T5AL1M98Orb9od lleksyrx2S/XhQs67oPg9Tm+t5kCDqO8q3F6aw/dG/pPf9NDZT9WZ9Tb0qWYEyIhIEJ2 6wti7JJtxioAcriK/TmE3J8ABXgh/kCqpsaOpSj0jj6leZyKNIKxgAkbTT1bD8ZFz/nu KQsQ==
- In-reply-to: <20160121135120.GC21104@cventin.lip.ens-lyon.fr>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20160114171631.GC12351@cventin.lip.ens-lyon.fr> <160114185941.ZM18307@torch.brasslantern.com> <20160121135120.GC21104@cventin.lip.ens-lyon.fr>
On Jan 21, 2:51pm, Vincent Lefevre wrote:
} Subject: Re: prompt update and TRAPCHLD
}
} On 2016-01-14 18:59:41 -0800, Bart Schaefer wrote:
} > The right thing is to explicitly tell ZLE to update the prompt:
} >
} > TRAPCHLD() {
} > psvar[1]=$RANDOM
} > [[ -o zle ]] && zle reset-prompt
} > }
}
} There's something wrong with it:
}
} TRAPCHLD:zle: widgets can only be called when ZLE is active
Oops, that should be
zle && zle reset-prompt
} > Or perhaps your complaint is that the TRAP* function should run sooner?
}
} I think I was surprised when doing some tests. I thought that there
} was some race condition in my code because the TRAPCHLD was run too
} soon, but that's the opposite! So, the problem is something else.
The rule actually is that traps are executed as early as it is "safe" to
do so (memory management, etc.), and one of those times is immediately
before another command is going to be run; so the trap could execute for
example at any time during your precmd function, or during zle-line-init,
etc.
So in that sense yes, there is a race condition.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author