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

Re: Mark descriptor as terminal for the -t test



Just returned from a trip where I had limited email access, so several
things to catch up on, maybe over a few days ...

On May 13, 10:18am, Sebastian Gniazdowski wrote:
} Subject: Mark descriptor as terminal for the -t test
}
} Having a descriptor X, pointing to a file or to a process (with >(cmd)
} redirection), is it possible to make it look like terminal? For the
} test -t to pass?

No.  The "is a terminal" state is at the OS level; the descriptor must
refer to a tty device file.

} The goal is: make this more robust:
}   exec > >(tee -a ~/$$.out)
} 
} It works, catches output of commands, however e.g. from vim, message
} about "output is not to a terminal" appears.

Almost any interactive command will be confused or broken by that usage.
This is the reason that e.g. the "script" command exists.

I presume this is related to your "ztrace" project.  I fear you're doomed
to failure with that one, except in a very simple cases.

It is theoretically possible to do something with the "zpty" module, but
keeping all the I/O in sync when an interactive command wants curses-type
functionality is extremely tricky, and you have to manage all keyboard
signals to propagate them through.



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