Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: W02jobs.ztst hangs with zsh 5.6.1



On Mon, 10 Sep 2018 15:50:32 +0000
Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> Peter Stephenson wrote on Mon, 10 Sep 2018 16:14 +0100:
> > It's unlikely zpty is going to get enough love and attention to be
> > robust enough for what we really need here.
> > 
> > I wonder if there is some replacement we could use that someone might
> > already know about?  The Python pty module looked like it might be
> > usable, but I encountered half a dozen Python-style illogicalities before
> > getting a dozen lines into a programme, so we'll need some existing
> > script to start with.  
> 
> Could you explain what that replacement (in Python or anything else)
> needs to do?  Are you asking for a program that launches ../Src/zsh in a
> pty and then writes the stty(1) 'susp' character to that pty?  (At this
> point the program could just send SIGTSTP directly, too; I'm not sure
> if that's an option.)

As near a direct replacement for ztpy as possible, but basically all it
needs to be able to do is spwan a slave running zsh, write to that, and
read back from it.  You'd have thought that wasn't too hard, but
experience suggests otherwise.

I got some life with the Ruby pty module, based on the example in the
documentation.  I haven't worked out how to get the right file
descriptors in the right place, so this is a non-working exmaple of
particular things we want to do more generically --- i.e. pass in
instructions to read and write, then look at the results returned,
rather than hard wire.

pws


require 'pty'

master, slave = PTY.open
read, write = IO.pipe
::ENV["PS1"] = ""
pid = spawn("zsh", "-fV", "+Z", :in=>read, :out=>slave)
read.close     # we dont need the read
slave.close    # or the slave

write.puts 'print $ZSH_VERSION'
p master.gets

# Write is a normal pipe so this doesn't actually work.
write.puts "stty susp \^z"

write.puts 'sleep 5'
# \C-z: again, this isn't actually going to the terminal.
write.printf "%c", 26
p master.gets
# hoping to see something involving a stopped / suspended message.



Messages sorted by: Reverse Date, Date, Thread, Author