zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Stephane Chazelas <stephane@chazelas.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] [doc] clone module using xterm's slave mode
Date: Tue, 19 May 2020 01:01:40 +0000	[thread overview]
Message-ID: <20200519010140.38c12d2b@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20200517101347.g7v6k2g7hoew636q@chazelas.org>

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).
> 
> 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).
> 

Thanks!

> +++ b/Doc/Zsh/mod_clone.yo
> @@ -39,11 +39,30 @@ enditemize()
>  
>  This does not apply when cloning to an em(unused) vc.
>  
> +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:
>  
> +example(socat pty,link=pty,wait-slave,echo=0 'exec:xterm -Spty/3,nofork,fdout=3,fdin=3' &
> +        clone pty; (($!)) || { IFS= read -r WINDOWID && ((WINDOWID = 0x$WINDOWID));})

There's a race condition here («clone» might run before «./pty» is
created).  Is it worthwhile to point it out in the text, or add
a «sleep» in the example?

By the way, WDYT of adding a concept index entry (e.g., «cindex(tty,
cloning the shell onto an unused)») at the top of the file?  I think the
existing cindex entries won't help someone who doesn't know what the
module is called to discover it.

More later…

Cheers,

Daniel

  parent reply	other threads:[~2020-05-19  1:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 10:13 Stephane Chazelas
2020-05-17 20:19 ` Mikael Magnusson
2020-05-18  6:14   ` [PATCHv2] " Stephane Chazelas
2020-05-19  1:01 ` Daniel Shahaf [this message]
2020-05-19 18:54   ` [PATCH] " Stephane Chazelas
2020-05-19 23:36     ` Daniel Shahaf

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=20200519010140.38c12d2b@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=stephane@chazelas.org \
    --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).