I think I do not understand that the getty / agetty / mgetty program function is on the linux / unix machine. I can run the shell on tty with something like this:
TTY = '/dev/tty3' cpid = os.fork() if cpid == 0: os.closerange(0, 4) sys.stdin = open(TTY, 'r') sys.stdout = open(TTY, 'w') sys.stderr = open(TTY, 'w') os.execv(('/bin/bash',), ('bash',))
.. and if I switch to tty3, the shell will start, but some keystrokes are ignored / never sent to the shell. the shell knows that the TTY settings are incorrect, because bash will say something like "could not open tty, job control is disabled"
I know that the termios module has functions for changing TTY settings, which is what the 'tty' module uses, but I cannot find an example of how python correctly installs TTY and starts the shell. I feel that it should be something simple, but I donβt know where to look.
looking at the source for * etty programs did not help me - C looks like Greek to me: - /
Maybe they just do not need the right conditions? Has anyone replaced * etty with Python in the past and got an explanation they would like to share?
Thank you for your interest in my main question :)
source share