From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 889 invoked from network); 26 Apr 2021 03:22:52 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Apr 2021 03:22:52 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619407372; b=XQhuRL+IVGNxkBhbewfc6ZHzZrUu840yppx8bNWVIdZtBPC/eYEc6q0Xr1ji2y+YjlNsqRBsGl rMwvwvi1ceRGtJsIQC9mGPktPzGaZSiM0yfDLIX/bGJp7+54UlmlCJB7HhC0qMKej7vbNXPc5r Uw2QZGhIy8IoLVAStg62skedug0tecTSDrP7mPs/2gyUHj9b217c/uJUwQk18ewcBtf66m74fr YUBLOzcy4rpcYoLtm9mrnfZ5Uo8bdLfZtFCP3tHSBE7Fzy06nggIeAaZQDuiYFFIKWvG/kBSQc vmOmBynqVOSGirDqIZ5ZYrRRa1wl0XB1dTcWTrw9JOKzBw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619407372; bh=7NVxa2yxHQhEdxYIryV5qBIDSmtG7qcIiFZ6sTFbQuc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature:DKIM-Signature:DKIM-Signature; b=KzR368mdKBQCssD98wm4DDGka6K0GDWVCc3kc5dxHdFSJqVyOBGrvW6Nv4LBNo82ZWEKeloCTg xurCPWIztBAR9hPkbu6qkc1CPluH1fMso2f8Jy3YxcmhDiFfm9LYyIZUQY0k0mCJMPTw7oBBOV EcoBBLsfaAO8LYBC3BkkbyWYXPUXiRpJ8N6wpWRuLDYclxUk4zcZseUMoXtsedZ93RQSBNNXJ6 WeksTdWTadXRCTk8hvcQhu9KMX0GX7vSjP6DCDMy5xIzpaE89sJinnWoKZt67+uyN9odrh/Ym4 AzQMuIImhtTsBd0UIv1qj6uW1jNKOAhc77YOjk6J1f5+bQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=EpgFPd4VS/iPRh0a82BvCSr6ALVI+oVwtTHfN6o4bsM=; b=iaMniCtFIWwUluObJk4wBZK24G pEq89AsXpBhHtRWsB02BMuRjmvlxBLgJ7gUUfUL7jqVQKQ4fb/bJfyTDT1RhwYUGQEFhHOJ7tgpSS y6o4KhymgIT4RJ7mwcJ/8jca4GxR7XvVZ6NEVptiZJmjYLkbCMsZKve3+44GuOVO1uDo3Vqrg3mGT dKFkWQt3YfF8AMF4wqw0YnAH6wFzYh5D7uuJ3loqOFQPDADhDCsubODCrBCp5vlAy2oG+dVpafMu+ Be4cL34bhpihocFkLUInhHYjFr1OnvVtUUbuwIeurPcIGgKm7gh8i53eTobJsDs2MKuQFDrNODzeD rQvDerEA==; Received: from authenticated user by zero.zsh.org with local id 1larpc-00095h-0d; Mon, 26 Apr 2021 03:22:44 +0000 Authentication-Results: zsh.org; iprev=pass (wout4-smtp.messagingengine.com) smtp.remote-ip=64.147.123.20; dkim=pass header.d=daniel.shahaf.name header.s=fm3 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:60971) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1larp0-0008pe-Vr; Mon, 26 Apr 2021 03:22:08 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 7C5711BA6; Sun, 25 Apr 2021 23:22:04 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 25 Apr 2021 23:22:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to; s=fm3; bh=Epg FPd4VS/iPRh0a82BvCSr6ALVI+oVwtTHfN6o4bsM=; b=qKyvzJDEoWrgTbiPU5C eW72ZbKitWp5QNLsVHJabbXR/AQeXKfq662cpfW/Q1NbFSxQX5EKzHZE5ubldoFE f/N7U4j1/rFjBYMj/d7eIVLk9+VI/dGEZrH6BlTDwXGF9Jk9fsQORGnaCm6fXcJG T3Rqo4TBI1Me4WoNvOaHSkcS62VmTGk3pfEkSHuE4pZ34mjmJr5o0vDJzJ14AqO+ bhUxzdJYdj3eVFl+zjb0KIlywfhTt4DlY4b8gO5wuNDP1+cXJT3UcWD2NBxDLiL9 4Jfa11yW0oIx50gWUHhk7JMBMfTtKhRGy4YioAYKSIDELAS8CxoGYBUEBLFbSysL 45g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=EpgFPd 4VS/iPRh0a82BvCSr6ALVI+oVwtTHfN6o4bsM=; b=U1TZlh0Mw5XWtsNP3Qg7NV HkVvRpuEX1ay1aHjBsjVzyK2rwysNemcZhsr1mSxXimGXYV+Bld5iKeXnALKoW9W 4ox56uFaU9813pgGvEHjLo/dzEwyNDXYbiwz9HePSUe8g0aHgwmNXT4grkwk0Oyh rf5jpjzmRxnZnHTUi+JvtXlR5Drgz5MDz85mVeWc5roLUfHAsp3T5JcBiRiWPNx1 kfYH7B0jNqgitRCncmVD8tM8Zi8GH5M4j3dRAhw1/0EeounxY2YDg+5OaClv/gtg V38NIWkuftVcwrZLGd2LR0NoW5KhWnQkknFd5uulq8Ju6+LLZgLMUmcz7NBIZOtg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddujedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjfgesthdttddttdervdenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cuggftrfgrthhtvghrnhepueevkeefffeufeehfefhgefffedviedthedtgeeljeelvdei hfevjeefteegvdeknecukfhppedutdelrdeiiedrieefrddvfedtnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhs hhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-109-66-63-230.red.bezeqint.net [109.66.63.230]) by mail.messagingengine.com (Postfix) with ESMTPA id B3C20240054; Sun, 25 Apr 2021 23:22:03 -0400 (EDT) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4FT9DS6Xq1z240; Mon, 26 Apr 2021 03:22:00 +0000 (UTC) Date: Mon, 26 Apr 2021 03:22:00 +0000 From: Daniel Shahaf To: Marlon Richert Cc: Zsh hackers list Subject: Re: [RFC][PATCH] Add zrestart() Message-ID: <20210426032200.GA26443@tarpaulin.shahaf.local2> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 48713 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: > Subject: [PATCH] Add zrestart() Nitpick, but the parentheses are wrong. They imply zrestart() is a C function, which it isn't. > +++ b/Doc/Zsh/contrib.yo > @@ -4649,6 +4649,11 @@ See `Recompiling Functions' > ifzman(above)\ > ifnzman((noderef(Utilities))). > ) > +findex(zrestart) > +item(tt(zrestart))( > +This function tests whether the shell is able to restart without error and, if > +so, restarts the shell. > +) > +++ b/Functions/Misc/zrestart > @@ -0,0 +1,42 @@ > +# > +# Restarts the shell if and only if it can restart without error. > +# > + > +emulate -LR zsh > +{ > + # Some users export $ZDOTDIR, which can mess things up. > + local zdotdir=$ZDOTDIR > + unset ZDOTDIR The comment implies those users are doing something unusual, which isn't the case. Exporting ZDOTDIR is normal. More importantly, I don't see any reason to munge $ZDOTDIR in the first place. It amounts to second-guessing the user. > + print 'Validating...' Error and progress messages should name their originator. > + # Try if the shell can start up without errors. Passing an empty command > + # ensures that the subshell exits immediately after executing all dotfiles. > + # We suppress standard out, since we're interested in standard error only. > + setopt multios This option will already be on, and in any case isn't required for the next line. > + local err="$(zsh --interactive --monitor --zle -c '' 2>&1 > /dev/null)" This doesn't necessarily restart the _same_ zsh, if there's more than one installed. Also, I think it's quite a stretch to describe this line as "_tests_ whether the shell is able to restart". This line executes a whole bunch of code you have no control over. I don't think that's an acceptable approach.