python-security/pyt

Inappropriate ioctl using Ubuntu and pty

ruapotato opened this issue · 3 comments

I'm working on a terminal multiplexer written in python. On Ubuntu based distros, I'm seeing the error:

bash: cannot set terminal process group (9862): Inappropriate ioctl for device
bash: no job control in this shell
tmp@tmp-VirtualBox:

On openSuSE and Fedora, I don't see the ioctl error and job contol works fine.

Example issue:

#!/usr/bin/python3

import subprocess
import sys
import pty
import os

master, slave = pty.openpty()

bashCMD = "bash".split()
p = subprocess.Popen(bashCMD, preexec_fn=os.setsid, stdin=slave, stdout=slave, stderr=slave, universal_newlines=True, shell=True)


while p.poll() is None:
  data = os.read(master, 1026)
  print(str(data))

Full project: https://bitbucket.org/hackersgame/janit/src/master/

Hi @ruapotato, I think you got the wrong project. It seems like you're looking for pty, not pyt.

Hello @adrianbn, I think your right... Sorry for the dyslexic post.