headless: Fix some Python warnings.

Also, on newer pythons, this was crashing entirely.
This commit is contained in:
Unknown W. Brackets 2021-09-13 07:24:59 -07:00
parent bb3a03adac
commit 2ecaa61fa5

View File

@ -43,7 +43,7 @@ class Command(object):
def run(self, timeout):
def target():
self.process = subprocess.Popen(self.cmd, bufsize=1, stdin=subprocess.PIPE, stdout=sys.stdout, stderr=subprocess.STDOUT)
self.process = subprocess.Popen(self.cmd, stdin=subprocess.PIPE, stdout=sys.stdout, stderr=subprocess.STDOUT)
self.process.stdin.write(self.data.encode('utf-8'))
self.process.stdin.close()
self.process.communicate()
@ -52,7 +52,7 @@ class Command(object):
thread.start()
thread.join(timeout)
if thread.isAlive():
if thread.is_alive():
self.timeout = True
if sys.version_info < (2, 6):
os.kill(self.process.pid, signal.SIGKILL)