zsh-workers
 help / color / mirror / code / Atom feed
From: Marlon Richert <marlon.richert@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Daniel Shahaf <d.s@daniel.shahaf.name>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [RFC][PATCH] Add zrestart()
Date: Tue, 27 Apr 2021 14:42:47 +0300	[thread overview]
Message-ID: <CAHLkEDvPrZHojHL2NpcCh2GhkFLAS28+Dv+B4cVtREF6MTNn5Q@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7av88Rd_=9QQWXyk87jnbpfE4qX1qC+AkcBDFg588OUoA@mail.gmail.com>

On Tue, Apr 27, 2021 at 2:55 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Mon, Apr 26, 2021 at 12:30 PM Daniel Shahaf <d.s@daniel.shahaf.name> 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?


  reply	other threads:[~2021-04-27 11:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-24 20:50 Marlon Richert
2021-04-26  3:22 ` Daniel Shahaf
2021-04-26 19:03   ` Marlon Richert
2021-04-26 19:29     ` Daniel Shahaf
2021-04-26 23:54       ` Bart Schaefer
2021-04-27 11:42         ` Marlon Richert [this message]
2021-04-27 11:49           ` Roman Perepelitsa
2021-04-27 17:49             ` Marlon Richert
2021-04-27 17:57               ` Marlon Richert
2021-04-27 18:37                 ` Bart Schaefer
2021-04-29 13:58           ` Daniel Shahaf
2021-04-27 11:37       ` Marlon Richert
2021-04-29 14:12         ` Daniel Shahaf
2021-04-30 17:27           ` Marlon Richert
2021-05-09 20:59             ` Lawrence Velázquez
2021-05-09 22:52               ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHLkEDvPrZHojHL2NpcCh2GhkFLAS28+Dv+B4cVtREF6MTNn5Q@mail.gmail.com \
    --to=marlon.richert@gmail.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).