Skip to contentSkip to conversation

testdisplay: only set terminal attributes when in foreground process group

PATCH New Thomas Wood 1 participant 1 message Jul 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testdisplay: only set terminal attributes when in foreground process group

The Piglit test runner for intel-gpu-tools creates a new process group for the test processes, so attempting to set terminal attributes causes the process to receive SIGTTOU and be stopped. Since the test is not run interactively in this case, the issue can be avoided by not setting terminal attributes if the process is not in the foreground process group.

---
 tests/testdisplay.c | 5 +++++
 1 file changed, 5 insertions(+)
tests/testdisplay.c +5 -0
index 6d8fe3a..f60e66d 100644
@@ -725,6 +725,11 @@ static void set_termio_mode(void)
 {
 	struct termios tio;
 
+	/* don't attempt to set terminal attributes if not in the foreground
+	 * process group */
+	if (getpgrp() != tcgetpgrp(STDOUT_FILENO))
+		return;
+
 	tio_fd = dup(STDIN_FILENO);
 	tcgetattr(tio_fd, &saved_tio);
 	igt_install_exit_handler(restore_termio_mode);
Signature · 1 line
1.9.3