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

Re: PATCH: Allow using STTY= to save terminal state



Mikael Magnusson wrote on Wed, Jan 19, 2022 at 00:17:10 +0100:
> That said, running ttyctl -f and ttyctl -u around a command is a bit
> more work than simply prepending STTY=

So perhaps we need some syntactic sugar for "wrap a command with
a well-known pair of before/after modifiers".  I'm thinking of something
similar to Python context managers, where
.
    with open("foo.txt") as fd:
        ...
.
is syntactic sugar for
.
    try:
        fd = open("foo.txt")
        ...
    finally: # equivalent to «always» in zsh
        close(fd)
.
.




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