Finding the terminal your script is running in - Programming On Unix
Users browsing this thread: 1 Guest(s)
|
|||
(03-07-2016, 12:41 PM)vain Wrote:Quote:I tried with a terminal multiplexer, they lead back to the right terminal, so no issues on that part.Actually, that got me thinking. Is that correct? GNU screen does indeed hold an open fd to /dev/ptmx, but my method above can't find it: Oh, I also had to use sudo. So the permission is an issue too. (03-07-2016, 12:41 PM)vain Wrote: From what I understand, terminal emulators call `openpty()` which gets them a pair of connected file descriptors. The "slave" end is something like `/dev/pts/4` and this is what the shell and other programs see. So, what I'm really looking for would be the "master" end. Meaning, if you run a multiplexer, then that's "the" terminal because this process originally called `openpty()`. (So my script gives the wrong answer, due to missing permissions.) It also got me thinking into the definition of what is a terminal. If you write a terminal that works using two parts, client and server, which one do you consider to be the terminal? Probably the server but there's no direct interaction with the server. Quote:The role of the terminal emulator process is: |
|||
Messages In This Thread |
Finding the terminal your script is running in - by movq - 02-07-2016, 02:23 PM
RE: Finding the terminal your script is running in - by venam - 03-07-2016, 01:56 AM
RE: Finding the terminal your script is running in - by movq - 03-07-2016, 12:41 PM
RE: Finding the terminal your script is running in - by venam - 03-07-2016, 01:12 PM
RE: Finding the terminal your script is running in - by venam - 12-08-2020, 08:11 AM
RE: Finding the terminal your script is running in - by z3bra - 12-08-2020, 08:43 AM
RE: Finding the terminal your script is running in - by movq - 13-08-2020, 06:45 AM
RE: Finding the terminal your script is running in - by venam - 05-06-2021, 05:26 AM
|