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

Re: interact

Anthony.Iano-Fletcher@xxxxxxxxxxxxxxxx wrote:
> > In principle, you could move the
> > setting of the interactive option into the code I just adapted to be
> > run both when the shell starts up and after `exec <...', which already
> > checks for a tty.  You probably have to wait a bit for that code to
> > show up.
> Fine I can wait...... Would this allow for the zsh script to call for
> more that one interactive sessions? or to continue executing after
> the exec?  Surely if I do 
> 		exec < /dev/tty
> and the user types control-D then the shell will exit.

I looked at this a little more closely --- it turns out it's not
ksh-compatible: running ksh on a file containing

print this is before
exec <file
print this is after

shows that it doesn't change command input to stdin, only input for
'read' etc.

It might therefore be better to implement this a more specific way,
like handling `setopt interactive' specially, then passing initio() or
whatever a flag saying whether it has to switch to using stdin for
input.  This is certainly feasible, though probably it ought to wait:
it looks like being a bigger change than I'd hoped to do it properly.
If done properly, though, interactive sessions should be able to
behave just like they usually do.

Peter Stephenson <P.Stephenson@xxxxxxxxxxxxx>  Tel: +44 1792 205678 extn. 4461
WWW:  http://python.swan.ac.uk/~pypeters/      Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.

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