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=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2814 invoked from network); 19 May 2020 01:02:28 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 19 May 2020 01:02:28 -0000 Received: (qmail 6740 invoked by alias); 19 May 2020 01:02:23 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45842 Received: (qmail 7890 invoked by uid 1010); 19 May 2020 01:02:23 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25814. spamassassin: 3.4.4. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 2.267298 secs); 19 May 2020 01:02:23 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddtiedggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfgjfhfogggtgfesthhqtddtredtjeenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cuggftrfgrthhtvghrnhephfdtteefheevuedthedutdeifeegteettdejtdffheduieei jeelteetkeduteehnecukfhppeejledrudejjedrudefgedrfeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhh rghhrghfrdhnrghmvg X-ME-Proxy: Date: Tue, 19 May 2020 01:01:40 +0000 From: Daniel Shahaf To: Stephane Chazelas Cc: Zsh hackers list Subject: Re: [PATCH] [doc] clone module using xterm's slave mode Message-ID: <20200519010140.38c12d2b@tarpaulin.shahaf.local2> In-Reply-To: <20200517101347.g7v6k2g7hoew636q@chazelas.org> References: <20200517101347.g7v6k2g7hoew636q@chazelas.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Stephane Chazelas wrote on Sun, 17 May 2020 11:13 +0100: > Hi, while testing the patch for the pgrp restore issue, I came > up with a way to clone zsh onto a xterm and attach to the tty > device properly there (using xterm's slave mode). >=20 > Here's a doc patch to document that approach (requires socat, > though the same could be done with expect or some perl/python > pty module). >=20 Thanks! > +++ b/Doc/Zsh/mod_clone.yo > @@ -39,11 +39,30 @@ enditemize() > =20 > This does not apply when cloning to an em(unused) vc. > =20 > +It is possible however to clone zsh onto a xterm and that zsh process > +to lead the session attached to that terminal by using tt(xterm)'s slave > +mode in conjunction with an utility like tt(socat) that can create a > +pseudo-terminal pair: > =20 > +example(socat pty,link=3Dpty,wait-slave,echo=3D0 'exec:xterm -Spty/3,nof= ork,fdout=3D3,fdin=3D3' & > + clone pty; (($!)) || { IFS=3D read -r WINDOWID && ((WINDOWID =3D= 0x$WINDOWID));}) There's a race condition here (=C2=ABclone=C2=BB might run before =C2=AB./p= ty=C2=BB is created). Is it worthwhile to point it out in the text, or add a =C2=ABsleep=C2=BB in the example? By the way, WDYT of adding a concept index entry (e.g., =C2=ABcindex(tty, cloning the shell onto an unused)=C2=BB) at the top of the file? I think t= he existing cindex entries won't help someone who doesn't know what the module is called to discover it. More later=E2=80=A6 Cheers, Daniel