Skip to content

Commit afb34e3

Browse files
Eugeniy Paltsevnashif
authored andcommitted
twister: check if output is connected to tty before 'stty sane' call
As of today we unconditionally call 'stty sane' that leads to lots of error messages 'stty: standard input: Inappropriate ioctl for device' when output isn't connected to tty (for example when we launch twister in Jenkins) Fix that by check if output is really connected to tty before 'stty sane' call. Signed-off-by: Eugeniy Paltsev <[email protected]>
1 parent 698db69 commit afb34e3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/pylib/twister/twisterlib.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,9 @@ def handle(self):
564564

565565
# FIXME: This is needed when killing the simulator, the console is
566566
# garbled and needs to be reset. Did not find a better way to do that.
567+
if sys.stdout.isatty():
568+
subprocess.call(["stty", "sane"])
567569

568-
subprocess.call(["stty", "sane"])
569570
self.instance.results = harness.tests
570571

571572
if not self.terminated and self.returncode != 0:
@@ -1063,7 +1064,8 @@ def handle(self):
10631064
self.thread.daemon = True
10641065
logger.debug("Spawning QEMUHandler Thread for %s" % self.name)
10651066
self.thread.start()
1066-
subprocess.call(["stty", "sane"])
1067+
if sys.stdout.isatty():
1068+
subprocess.call(["stty", "sane"])
10671069

10681070
logger.debug("Running %s (%s)" % (self.name, self.type_str))
10691071
command = [self.generator_cmd]

0 commit comments

Comments
 (0)