Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [RFC][PATCH] Add zrestart()
On Tue, Apr 27, 2021 at 2:55 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Mon, Apr 26, 2021 at 12:30 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > > What kind of approach would be acceptable?
> >
> > I think you've basically run into the halting problem here
>
> Consequently we need to decide collectively whether we're just
> rejecting "zrestart" as impossible, or if there's a sub-optimal
> solution we can agree on. I suspect that executing the entire startup
> twice in order to be sure it'll work once, is not one we'll agree on.
>
> Not really a solution, but an interesting (?) observation:
>
> If you start an interactive shell in the background, it will stop when
> it tries to print the first prompt:
>
> % echo $$
> 277859
> % Src/zsh -f &
> [1] 277861
> %
> [1] + suspended (tty output) Src/zsh -f
>
> You can then do:
>
> % exec fg
> [1] + continued Src/zsh -f
> % echo $$
> 277861
> %
>
> Now you're at the prompt for the previously backgrounded shell. If
> you exit from that, the parent is gone.
>
> So if you had some way to detect that a backgrounded shell had
> actually reached the PS1 prompt, you could cause the parent shell to
> replace itself.
Failing that, perhaps a better option would just be to add a note in
the newuser .zshrc to use `zsh` or `zsh && exit` to apply changes?
Or perhaps zrestart could be just this:
zrestart() {
exec zsh
}
At least then the user has no risk of mistyping the argument to exec.
By the way: What kind of error in the dotfiles would cause the shell
not to be able to start?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author